Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-09-08
8
Medium Priority
?
2,658 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 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 80

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 29

Expert Comment

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

Any issues with it?
0
 
LVL 80

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 80

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

886 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