Read from Text File and Replace String using Powershell
For now , I have this command below that works fine when I run it against one remote computer named Windows7 and Replacing one string "username" with "white"
but when I have many computers, then it does not help
((Get-Content -Path '\\Windows7\c$\test.txt' -Raw) -replace ' username', ' white') | Set-Content -Path '\\Windows7\C$\test.txt'
I will have to put in a separate Text file like this:
the first column is the remote computer name and the second column is the string that will replace the second username.
As I stated , the command I pasted above works just fine, it needs to read from a separate text file so that the command will apply to several computers listed on the text file.