Reading the Notepad file content and modifying them using powershell.

This topic contains 1 reply, has 1 voice, and was last updated by Profile photo of Narayan Gupta Narayan Gupta 5 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #37180
    Profile photo of Narayan Gupta
    Narayan Gupta
    Participant

    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

    #37181
    Profile photo of Narayan Gupta
    Narayan Gupta
    Participant

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

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.