Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Edit Ini Files

$
0
0

I  wanted to find out if you can help me with a script that will edit .ini files, and update the server name. We have about 1700 ini files. That need to have new print server names since the old server is are going to be decommissioned soon.

The filed that needs to be updated is the Host value. Ie if the Host value is Host = “KBFILE01” it should be update to Host = “vKBprt01”

** The problem that I am having is that instead of the script replace the value in Host it is replacing the whole line.

Before Script:

Printer=SMB2 Local Name="Windows Printer | LB-28-11" Host="KBFILE01" Name="LB-28-11" PrinterID="HP LaserJet 4100 Series PCL6" Class="PCL5" Enabled=yes

I need it to be like :

Printer=SMB2 Local Name="Windows Printer | LB-28-11" Host="vKBprt01" Name="LB-28-11" PrinterID="HP LaserJet 4100 Series PCL6" Class="PCL5" Enabled=yes

Thanks


Viewing all articles
Browse latest Browse all 6937

Trending Articles