I am trying to replace "\\Server1-123", but I need to use range of characters because the server name changes and I do not know what it will be next time, how can I go about this?
Below variable is what I tried, but alas, did not work:
$anyvalue = "[^*\*A-Za-z0-9_-.]"
below is the xml value I am working with
"<add key=`"My.Unique.Repository`" value=`"\\Server1-123`" />"
here is the full code:
$con = Get-Content "\\server\c$\Program Files\TEST\IIS\web.config"
$anyvalue = "[^*\\*A-Za-z0-9_-.]"
$stuffIwant = "\\Blah-244"
$con | % { $_.Replace("<add key=`"My.Uniqe.Repository`" value=`"\\Server1-123`" />", "<add key=`"My.Uniqe.Repository`" value=`"$stuffIwant`" />") } | `
Set-Content "\\server\c$\Program Files\TEST\IIS\web.config" -force -Encoding UTF8