Jump to content

Recommended Posts


We have about 100 windows 98 boxes, each box has a different printers Installed with a TCP/IP local port and comunicate straight to the printer through its static IP. We want to change the IP addresses of these printers and run script on win98 to search the registry for the old IPs and replace them with the new ones. Can search and replace registry values be done with Autoit? if so can any one please shad some light.

Thank you


Link to post
Share on other sites

Hi Larry,

See the thing is each win98 machine has 2 or up to 4 different printers installed all through a TCP/IP local port, and I don't know which printers are Installed where. I just have the IP addresses of the 20 or so printers, so I was thinking may be there could be something like

If registry Exist, 68.76.x.x then replace with 172.16.x.x

I hope I clearified it better

Thank you

Link to post
Share on other sites

You may be planning to do this already, but if not consider this. Use a program (Regsnap or something similar) that can compare registry changes, take a snapshot of the registry as it currently is. Then, change the IP address of one of the printers to the corresponding 'new' IP on that machine and take another snapshot afterwards and compare the changes in the registry. Assuming that the printer models do not change, the drivers should not change and it should be relatively easy to see what keys are effected that relate to the IP Address.


Link to post
Share on other sites

Thanks ZenKensei for the tip

I can change the IP manualy from the registry, and all works fine, but I need to do this from the logon script, the registry keys differ on all machines, I also don't know what printers are Installed where, I just want to be able to search for ip under print hive and simply replace it with the corresponding new IP, I have the ip addresses of all printers, we will be replacing the printers IP addresses as an example to to to to

So the machines old ip will need to be replaced as well. bellow is a reg key from one machine

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Monitors\HP JetDirect Port\Ports\NPI8C3491]





[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Monitors\HP JetDirect Port\Ports\NPI4FD688]





if this cannot be done using Autoit what would be the best approch.

Thank you all


Link to post
Share on other sites

More help needed,

Ok. I exported the registry ports key, but was unsuccessful getting String Replace to work for me. I have searched the help file, this forum, and the Internet before posting here and was not successful replacing a single word in the .reg file :D


I am trying to search for only if found then replace it with

I also need NOT to change the key "IP_172.16.1.24" because it is a key and it will write a whole new key under ports and not replace it after I import it.

From c:\printerreg.reg

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_172.16.1.24]




"IPAddress"= ""



"SNMP Community"="public"

"SNMP Enabled"=dword:00000001

"SNMP Index"=dword:00000001

I have a long autoit ver 2 script that does a lots of basic functions and they all work perfectly, So any help that I can add to it since it's not ver 3 would be appreciated, but at this point I can use any help I can get.


Link to post
Share on other sites

This will read your regfile, replace the string and write a new file.

$INFILE = ".\print.reg"
$OUTFILE = ".\newprint.reg"


$DATA = StringReplace($DATA, '"IPAddress"= ""', '"IPAddress"= ""')

Link to post
Share on other sites

Hi again,

When I export the key using regedit /e the file is exported in a unicode and the new file is created, but it's empty.

When I export the file using regedit /a the file is exported as an ANSI, the new file is created with same content, but nothing is replaced. Am I doing something wrong?


Link to post
Share on other sites

your .reg file had a space after the = which are not normally present in an export file. "IPAddress"= ""

You may just need to remove the space from this line to make it work.

I exported using regedit /e /a print.reg "hkey......" and it worked. I'm using windows xp pro, that may have something to do with it.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...