Share via


VBScript for Adding Network Printers at User Logon

Many times over I have had the need to create logon scripts that would automatically add network printers for users as they logon.

The process is quite simple if you adopt a simple vbscript to connect the required printers and then apply a group policy that would run the script during logon.

Below is a simple script that will do what we require (remember save it as .vbs to run):

' Script to add printers during user logon

On Error resume Next ' ver important otherwise users will get errors on subsequent reconnections

' Create the variable to hold printer connections
Dim Our_Printers

' Create variables for each printer string
' You can create as many as you like here
Dim Printer_1, Printer_2

' Initialise our printers
Printer_1 = "\print-server\printer_1"
Printer_2 = "\print-server\printer_2"

' Initialise the printer connections object
Set Our_Printers = CreateObject("WScript.Network") 

' Connect each of our printers
Our_Printers.AddWindowsPrinterConnection Printer_1 
Our_Printers.AddWindowsPrinterConnection Printer_2

WScript.Quit