I have a .VBS file and I need to search it and find some text and then replace that something with new text.
Here is what the .VBS script looks like.
WINDOWS NETWORK PRINTER 1
sPrinter1 = "\\MGMG17PS\MGIS119Q"
WshNetwork.AddWindowsPrinterConnection sPrinter1
WshNetwork.SetDefaultPrinter sPrinter1
'
' WINDOWS NETWORK PRINTER 2
sPrinter2 = "\\MGMG17PS\MGIS130Q"
WshNetwork.AddWindowsPrinterConnection sPrinter2
'
' WINDOWS NETWORK PRINTER 3
sPrinter3 = "\\SERVER\QUEUE"
WshNetwork.AddWindowsPrinterConnection sPrinter3
Here is my code that does not work.
Get-Content "c:\temp\searchreplace.vbs" | Foreach-Object {$_ -replace "MGMG17PS!$", "MGH-PRINT01"} | Set-Content "c:\temp\searchreplace2.txt"
What am I missing?