Solved

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

Posted on 2014-09-08
8
1,587 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
  • 3
  • 3
  • 2
8 Comments
 
LVL 28

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 76

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
 
LVL 28

Expert Comment

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

Any issues with it?
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 76

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 76

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 28

Accepted Solution

by:
becraig earned 500 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

Want to promote your upcoming event?

Are you going to an event? Are you going to be exhibiting at a tradeshow? Talking at a conference? Using a promotional banner in your email signature ensures that your organization’s most important contacts stay in the know and can potentially spread the word about the event.

Join & Write a Comment

Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now