Author Posts

April 3, 2016 at 4:55 am

Hi Mates,

I need help with below:

1. One CSV file which has server name and its IP address.
2. two conf files is placed on each server under c:\temp named as abc.conf and xyx.conf. 2nd line of the files contains IP address (xx.xxx.xx.xxx).
3. I want powershell to read the csv, pick the IP address against the server name from csv.
4.and Replace ip address in conf files on 2nd line only for each server with the picked IP in step3.
5. I want to verify the changes using powershell also.

Cheers,
Narayan

April 3, 2016 at 5:42 am

(get-content c:\1.txt) | foreach-object {$_ -replace "abc", "xyz"} | set-content c:\1.txt