Reading the Notepad file content and modifying them using powershell.

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.
  4. I want to verify the changes using powershell also.

Cheers,
Narayan

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