Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Illegal characters in path. using variables as file name.

$
0
0

How to make this work. Thank you in advance. 

 

$save = [Microsoft.VisualBasic.Interaction]::InputBox("What's your unid?(This will save it to your desktop)", "$pName", "")

$unid = [Microsoft.VisualBasic.Interaction]::InputBox("Enter the unid.", "$pName", "")

 

$name = Get-ADUser $unid | Select GivenName, Surname | ft -HideTableHeaders | Out-String

$fileName = "$name"+"$unid" | out-string

 

$service = get-adPrincipalGroupMembership $unid | Select Name | Sort Name  | Export-csv C:\Users\$save\Desktop\$fileName.csv

 

Results

Export-csv : Illegal characters in path.


Viewing all articles
Browse latest Browse all 6937

Trending Articles