none
Change the IP address of existing printer port. RRS feed

  • Question

  • We have been given a task of changing the IP Addresses of our Network Printers (Actual Printer), which luckily will be carried out by our Local HP LaserJet Partner Technicians all 80 Printers on all sites.

    While my team is assigned to changes all configured Shared Printer IP Address.

    We are talking about the one recorded/configured under Printer Properties--->under "Ports" Section, Printer IP Address Setting) on all workstation which I believed time consuming and manpower entensive task.

    1 Computer at least 4 Network Printers are configured.

    We are planning to deploy a script via SCCM 2012 however I am not lucky to find a working script.

    We are targeting Windows XP, Windows 7, and Windows 8 OS Versions.

    I came to browse some details on the forums but it works on XP, however I tried on Windows 7 it didn't work at all:

    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/65487281-a8e0-485a-8ffe-1341d2e0b2f0/change-the-ip-address-of-existing-printer-port?forum=ITCG

    I just follow the script on the above forum by Bartek Bielawski: However I cant figure out what went wrong.

    Scriptsample.bat

    set IPToReplace=192.168.1.150
    set NewIP=192.168.1.100 @echo off for /f "delims=" %%I in ('reg query "HKLM\System\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports"') do @call :CheckIP %%I
    goto :EOF

     :CheckIP
    :: Need to replace "HKEY_LOCAL_MACHINE" with "HKLM"
    set KEY=%*
    set KEY=HKLM%KEY:~18%
    reg query "%KEY%" /v IPAddress 2> nul | find "%IPToReplace%" > nul || goto :EOF
    :: Found printer ports with given IP
    reg add "%KEY%" /v IPAddress /t REG_SZ /d %NEWIP% /f

    Output

    1. The Registry Entry has been changes from 192.168.1.150 to 192.168.1.100 successfully check in the Registry.

    2. System/Computer Has been restarted, check on the Registry once again (for the Shared Printer "PORTS" IP Address settings) the IP is 192.168.1.100 still in the registry which is good.

    3. Check the "HP ColorLaserjet" Printer Properties with the previous IP Address of 192.168.1.150, on the "Port" the previous IP Address which is 192.168.1.150 still there however "Unchecked", the new IP Address 192.168.1.100 did not register.

    Any help and suggestions? Maybe the above script needs few commands modification. Or maybe I need a deferent type of Script kindly share.


    • Edited by Arnel-101 Wednesday, November 12, 2014 9:19 AM Updating for Clarification
    Tuesday, November 11, 2014 4:19 PM

Answers

  • Change port on printers

    Get-WmiObject win32_tcpipprinterport -filter "hostaddress='192.168.1.150'" |
        ForEach-Object{
             $_.HostAddress='192.168.1.100'
             $_.Put()
        }
    


    ¯\_(ツ)_/¯

    • Marked as answer by Arnel-101 Wednesday, November 19, 2014 6:13 AM
    Wednesday, November 12, 2014 10:10 AM
  • These work locally or remotely at a CMD prompt or in a batch file:

    wmic path win32_tcpipprinterport where "hostaddress = '192.168.1.150'" get hostaddress wmic path win32_tcpipprinterport where "hostaddress = '192.168.1.150'" set hostaddress="192.168.1.100"



    ¯\_(ツ)_/¯

    Thank you for the scripts it works. Thanks

    • Marked as answer by Arnel-101 Wednesday, November 19, 2014 6:13 AM
    Wednesday, November 19, 2014 6:12 AM

All replies

  • You should be using a spooler to do this.  It eliminates the need for all of this and makes the printers manageable.

    Why would you change the IP on a workstation to change the printer IP.  Something here does not make sense.


    ¯\_(ツ)_/¯

    Tuesday, November 11, 2014 7:15 PM
  • You should be using a spooler to do this.  It eliminates the need for all of this and makes the printers manageable.

    Why would you change the IP on a workstation to change the printer IP.  Something here does not make sense.


    ¯\_(ツ)_/¯

    ----

    Thanks for the reply jrv.

    I believed I didn't state the right picture of what I am trying to Achieved.

    1. I Don't want to Change the IP Address of the Workstations, I want to change the shared Printer IP Address Recorded/configured on the Workstation Printer Properties. (Under the shared Printer "Ports" TCP-IP Ports configuration to redirect the Workstation to the new Printer IP Address).

    In our case 1 Workstation is connected to 4 shared Network Printers the least others could be 5 or 8 printers.

    My aim is to perform the IP Address change the without interrupting the End user and to also saved manpower, doing this will be tedious for us to manually go one by one and do it manually.

    2. Why we are changing the IP Address of the Network Printers, well lets just put it this way it is part of a policy.

    ======

    Can you share how can I do this by "spooler" what I understand is the "Print Spooler Services on windows", needs clarification on the details about "Spooler".

    Wednesday, November 12, 2014 9:09 AM
  • Are you saying you are reassigning all printers with new addresses.

    The printers should be installed on a print server that acts as a spooler.  The workstations then connect to the server via a share.  This allows you to change anything without having an issue with the clients.


    ¯\_(ツ)_/¯

    Wednesday, November 12, 2014 10:01 AM
  • Change port on printers

    Get-WmiObject win32_tcpipprinterport -filter "hostaddress='192.168.1.150'" |
        ForEach-Object{
             $_.HostAddress='192.168.1.100'
             $_.Put()
        }
    


    ¯\_(ツ)_/¯

    • Marked as answer by Arnel-101 Wednesday, November 19, 2014 6:13 AM
    Wednesday, November 12, 2014 10:10 AM
  • These work locally or remotely at a CMD prompt or in a batch file:

    wmic path win32_tcpipprinterport where "hostaddress = '192.168.1.150'" get hostaddress wmic path win32_tcpipprinterport where "hostaddress = '192.168.1.150'" set hostaddress="192.168.1.100"



    ¯\_(ツ)_/¯

    Wednesday, November 12, 2014 10:19 AM
  • These work locally or remotely at a CMD prompt or in a batch file:

    wmic path win32_tcpipprinterport where "hostaddress = '192.168.1.150'" get hostaddress wmic path win32_tcpipprinterport where "hostaddress = '192.168.1.150'" set hostaddress="192.168.1.100"



    ¯\_(ツ)_/¯

    Thank you for the scripts it works. Thanks

    • Marked as answer by Arnel-101 Wednesday, November 19, 2014 6:13 AM
    Wednesday, November 19, 2014 6:12 AM
  • I have exactly the same problem that described in the beginning of this topic, but for me (Windows 10 machines) the scripts don't work.. 
    Could you please advise, hot to achieve the same goal with Win10 machines?
    Tuesday, January 29, 2019 2:27 PM
  • Mathias,

    please do not add additional questions to other peoples threads. Create a new one for your self instead. You can place a link to this one if suitable or needed for clarification.

    Thanks.


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Tuesday, January 29, 2019 2:32 PM
  • Please do not Add questions to answered, closed and very old threads.  You must start your own topic.


    \_(ツ)_/

    Tuesday, January 29, 2019 2:34 PM