Simple ways to add an delete network printers - Printable Version +- Linux-Noob Forums (https://www.linux-noob.com/forums) +-- Forum: Windows Noob (https://www.linux-noob.com/forums/forum-5.html) +--- Forum: Tips and Tricks (https://www.linux-noob.com/forums/forum-73.html) +--- Thread: Simple ways to add an delete network printers (/thread-3902.html) |
Simple ways to add an delete network printers - Digerati - 2003-12-18 Adds a printer connection to a network printer. Script must be run on the local computer. Copy and paste in notepad and save as {filename}.vbs Set WshNetwork = CreateObject("WScript.Network") WshNetwork.AddWindowsPrinterConnection "\\PrintServer1\Xerox300" WshNetwork.SetDefaultPrinter "\\PrintServer1\Xerox300" Removes a printer connection to a network printer. Script must be run on the local computer. Set WshNetwork = WScript.CreateObject("WScript.Network") WshNetwork.RemovePrinterConnection "\\PrintServer1\Xerox300" You can add these in batch scripting or logon scripting to aid in the adding and removal of printers. add printer rundll32 printui.dll,PrintUIEntry /in /n \\server1\1220C delete printer rundll32 printui.dll,PrintUIEntry /dn /n \\server1\PRT4 Example of login script that mapps drives and adds a printer: net use * /delete /y net use H: \\server1\%username%$ /PERSISTENT:NO net use S: \\server1\shared /PERSISTENT:NO rundll32 printui.dll,PrintUIEntry /in /n \\server1\1220C |