In powershell if you have a string such as
Server\MyName
how to you replace it with
MyOtherServer\AnotherName
I have tried escaping with ' and using single quotes but that doesn't seem to work
There is the -replace operator, but it takes a regular expression (so you have to escape backslashes):
$s -replace 'Server\\MyName', 'MyOtherServer\AnotherName'
Of course, the necessary escaping only applies to the regex, not the replacement.