Kaseya Community

Network printer IP changing.

  • Hi everyone,

    We have a standard IP range for printers across all of our clients.

    Recently, I have noticed that one of these is not set to standard and following our policy of 'Same is good' I wish to update this to reflect our standard.

    I figure I can change the IP of the printer itself without having to travel on site and once I have a list of all the machines that require it, I can change the IP of the printer on their local machines so that it points to the correct IP.

    However, this would be even easier if I could script it! Unfortunately however, I am unaware of any way to action these changes via a script or cmd line command.

    Any ideas?

    Cheers,

    Legacy Forum Name: Network printer IP changing.,
    Legacy Posted By Username: LANWorx
  • Hi,

    I'm not sure of a totally generic way to do this since I've only tried this on my own PC with my printer (Officejet L7700).

    This printer is setup using a standard TCP/IP port. You can find the list of installed TCP/IP ports in the registry here:

    HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\

    In my case, I've got two different network printers installed, so you would have to be able to distinguish which printer's IP address you want to change. In my case the port is called HP_192.168.2.103_MY76J521R1 and there is a subkey here with that same name. Inside that key is a REG_SZ named IPAddress which contains the currently assigned address. I did a 'net stop spooler' and then modified that value, 'net start spooler' and then verified the results. It did indeed change the IP address for that port on the desired printer.

    If you know the port name and its the same on every machine you need to change, scripting the above actions should be fairly straightforward. If not, the logic might get a bit more complicated, but hopefully this will give you some ideas!

    Hope it helps,
    Chris

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: benny@geeksaknockin.com
  • You sir, are a champion!

    I'll give this a shot later today. Now, do you mean that the IP that all the machines are pointing to need to be the same in order for this to work, or the name of the printer on the machine, or the port type?

    For example, the current IP of the printer is:

    192.168.7.17

    The name on all machines SHOULD be:

    GYM_PTR

    The type of port is standard TCP/IP. No machines have this set up any other way.

    Cheers,

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: LANWorx
  • Just a follow up to this, the script worked perfectly!

    IF True

    THEN

    Execute Shell Command

    Parameter 1 : net stop spooler

    Parameter 2 : 0

    OS Type : 0

    Set Registry Value

    Parameter 1 : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.5.15\IPAddress

    Parameter 2 : 192.168.5.30

    Parameter 3 : REG_SZ

    OS Type : 0

    Execute Shell Command

    Parameter 1 : net start spooler

    Parameter 2 : 0

    OS Type : 0

    ELSE


    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: LANWorx
  • Great, thanks for letting me know!

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: benny@geeksaknockin.com