Solved

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

Posted on 2014-09-08
8
2,062 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 78

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
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 
LVL 29

Expert Comment

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

Any issues with it?
0
 
LVL 78

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 78

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

680 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