How to: Add a network printer with a script

Submitted by elio on 2005, July 29 - 3:50pm.
Groups: Toolbox

Step 1: Open Notepad.

Step 2: Paste the following block of text into Notepad and replace the values with the information for your printers. If you don't wish to set a default printer, remove that line.

Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\server\printer1"
WshNetwork.AddWindowsPrinterConnection "\\server\printer2"
WshNetwork.SetDefaultPrinter "\\server\printer1"

Step 3: Save your new VBScript as "addprinters.vbs".

Step 4: Use Group Policy to add this script as a logon script for the OU you want to assign the printers to.

Step 5: Log off the computers in that OU manually, remotely using psshutdown.exe, via another script, or ask users to log out when they leave for the day. When they log back in next morning the printers will be added.

its really good....but

Submitted by smehmood on 2007, September 28 - 2:54am.

thanx for the code and it worked pefectly fine... but if i login to any server it adds the printers on the server as well...which we dont want... any solution??? Thanks. Syed

Toolbox

Techonology tools and resources

Toolbox

  • You must login/register in order to contribute to this group.

Navigation

User login