I'm moving our printers off the old file server and onto a new print
server appliance. I'm using the scripts from this page:
http://www.microsoft.com/technet/scriptcenter/scripts/printing/client/default.mspx
The problem is that I want it to delete all printer connections coming
from \\serverA. And create new ones to shares on serverB. I don't
mind having to specify in each script which printers to add, but I
don't want to assume to know which printers the computers currently
have installed. I just want to delete ALL connections to the old
server.
This is the script I have now, but it has to be set up knowing which
printer is currently installed. And worse yet, after it runs once, the
printer is deleted. Then when you run it again (at login) it gives you
an error because it can't find the connection. If I could just remove
the error from being displayed, then I could just list ALL of the
printers from the old print server in the script and that would cover
me.
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.RemovePrinterConnection "\\serverA\printer01"
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\serverB\printer01"
WshNetwork.AddWindowsPrinterConnection "\\serverB\printer03"
WshNetwork.SetDefaultPrinter "\\serverB\printer03"
Thanks
Brandon Riffel