Not sure if you’ve every had an issue where you have to move printers from one print server to another… I have had this come up a couple times…
Here’s a little vbs that can be executed from a logon script, that will look at a mapped printer’s connection (which server it is on), remove it, and then map it to another system.
Keep in mind, all the printers on NEWSERVER must have the same share names as the OLDSERVER.
Basically this script enumerates each printer, looks for the server it is mapped from, deletes the printer, and then adds the new printer, which happens to be the same printer, but mapped on a different server.
Here is the code:
On Error Resume Next
Set WshNetwork = WScript.CreateObject(“WScript.Network”)
strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\” & strComputer & “rootcimv2”)
Set colItems = objWMIService.ExecQuery(“Select * from Win32_Printer”,,48)
For Each objItem in colItems
If objItem.ServerName = “\OLDSERVER” then
WshNetwork.RemovePrinterConnection objItem.ServerName & “” & objItem.ShareName, true, true
WshNetwork.AddWindowsPrinterConnection “\NEWSERVER” & objItem.Sharename
If you want to download it, you can find it here.
As always, you are welcome to use the script, but I will not be held liable if any issues arise.