Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

script to modify the tcp/ip adress of a printer port

Posted on 2014-09-08
8
Medium Priority
?
2,521 Views
Last Modified: 2014-09-10
Hi,

I Need to change the tcp/ip adresse port of a printer on 100 PC.
Is it possible to write a script for that, or modify directy in the registry by program  ?

Thanks.

Regards.
0
Comment
Question by:CBADET
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 29

Expert Comment

by:becraig
ID: 40310936
You can use powershell (I've not actually tested this but it should work):

gc c:\serverlist.txt | % {
$computer = $_
$printer =gwmi win32_printer -computername $computer -filter "Name='<Printer Name>'"
$printer.PortName='IP_x.x.x.x''
$printer.Put()
$newport = $printer.PortName
write-host "$printer updated with  $newport"
}

Open in new window

0
 
LVL 79

Expert Comment

by:arnold
ID: 40311164
Why not once and for all use GPO/GPP to push the printer to the clients using a print server?

How is the original printer deployed to those systems?
0
 

Author Comment

by:CBADET
ID: 40311369
the clients are not on the same network. The tcp/ip adress of the printer is a domain. This domain has changed, so we have to modify this domain on all the clients. That's why i search a script to modify it, or how to modify the registry to change the domain with a program.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 29

Expert Comment

by:becraig
ID: 40311381
Have you tested the script ?

Any issues with it?
0
 
LVL 79

Expert Comment

by:arnold
ID: 40311567
There are many scripts that deal with printers.

The issue that is unclear deals with access to the systems, are they on the same network/domain centrally managed?
If the printer was pushed using GPO, the change can be pushed in the same way.

All systems windows 7/8?

What is the relationship between the current and the new IP?

Some registry changes can be made, through the location of the settings vary based on the printer as well as the means by which they were added, I.e. As a system printer or as a user printer.
0
 

Author Comment

by:CBADET
ID: 40311675
The script doesn't work.

The pc clients are on Windows serveur 2003, windows server 2008, and windows xp.
They are on different networks. The printer is not on in VPN with the clients. The tcp/ip port is a wan ip adress. And This WAN IP Adress has changed.

Does anybody knows where tcp/ip printer ports are stored ?
I've just  Found the port name for printers here in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\printername
0
 
LVL 79

Expert Comment

by:arnold
ID: 40312495
Since you have windows 2003/2008.
Are the workstations using the server's as the print servers?

references could be in HKEY_CURRENT_USER\Printers\Connections

Update the servers by adding the TCP/IP port and then binding the printer to this new port

The registry info: HKLM\software\microsoft\windowsNT\CurrentVersion\Print

There are several changes.
Using the windows 2003/2008 as the print servers for their location will centralize and speed up the migration.  The workstations will always send their print jobs to the windows servers configured as the print server, should the IP change again, all you would need is to update the information on the print server (add TCP/IP port for the new IP, and then bind the existing printer to the new port)

http://technet.microsoft.com/en-us/library/hh875629.aspx

You can deploy printers on a per system basis or on a per user basis.


IMHO, this is the fastest way including the uniformity and "centralization" of managing.
0
 
LVL 29

Accepted Solution

by:
becraig earned 2000 total points
ID: 40312519
Here is a link that I think will give you what you need:
Registry command:
reg add "HKLM\System\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.1.150" /v IPAddress /t REG_SZ /d 192.168.1.100 /f

More info:
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/65487281-a8e0-485a-8ffe-1341d2e0b2f0/change-the-ip-address-of-existing-printer-port

I generally am against registry changes as a rule of thumb (personal preference).

Also instead of just saying the script does not work, it would help to have an idea of what errors you see, that is the idea behind helping to craft a solution.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question