Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple ways to add an delete network printers
#1

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

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)