Use the script below as part of a group policy user login script. It will delete all local printers and apply the network printers specified. Known to work on Windows XP, Windows Vista and Windows 7.
The advanced printer script deploys printers based on the Active Directory container, or OU name.
Printers by Computer
The script "printers_by_computer_OU.vbs" will look at the computer's active directory location; this is the recommended script to use. When a user logs in and this script is applied, the printers will be set based on the machines location. This is likely to be the most convenient to the user.
Printers by User
The script "printers_by_user_OU.vbs" will look at the user's active directory location. When a user logs in and this script is applied, the printers will always be the same, no matter where the user logs in. This gives the user consistent printer settings; however if they change location the printers offered may not be convenient.
Note that either script may increase login times as printer connections are made as the user logs in. Login times may be additionally increased for the first time the computer downloads and installs the appropriate printer driver from the server.
On Either Script
ElseIf strOU = "Year4" Then
For i = 1 to oPrinters.Count - 1 Step 2
WshNetwork.RemovePrinterConnection oPrinters.Item(i)
Next
objNetwork.AddWindowsPrinterConnection "\\servername\classroom4_printer"
objNetwork.SetDefaultPrinter "\\servername\classroom4_printer"
select * from Win32_OperatingSystem where (Version like "5.1%" or Version like "5.2%") and ProductType = "1"
Applies to: