Solved

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

Posted on 2014-09-08
8
1,864 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 77

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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 29

Expert Comment

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

Any issues with it?
0
 
LVL 77

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 77

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Undelete of overwritten files 27 84
do i need anti virus software with windows 10? 13 70
Remote control Windows CE 7 51
facebook change 4 37
Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
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…
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…
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…

809 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