Reputation: 11281
I have this line of code which gives me domain\username. However, I need to replace the \ with _. Do I have to do this multiple lines or I can do this in one line?
$UAN = $userProfile["AccountName"].Value
$UAN = $UAN.Replace("/","_")
The above does not work even if it's multiple line.
Upvotes: 0
Views: 3348
Reputation: 6561
Use -replace
$UAN = ($userProfile["AccountName"].Value) -replace "\\", "_"
Upvotes: 4