Advanced Printer Script for Deploying Network Printers

Advanced Printer Script

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"

Known Limitations

Tip: If you wish to apply the group policy containing this script to machines of a certain operating system, use group policy WMI filters. For example, this may help you deploy printers to Windows XP machines on a network where you already have a working printer deployment method for Windows 7 machines. Of course, its better if possible to segregate your Windows 7 and Windows XP machines into different OUs in Active directory, but this isn't always possible. For more information on WMI filters see this link. As an example, a Windows XP WMI filter is select * from Win32_OperatingSystem where (Version like "5.1%" or Version like "5.2%") and ProductType = "1"

Applies to:



Article ID: 271
Last updated: 17 Jan, 2014
Revision: 9
Third Party Products -> Windows Server -> Installation and Software -> Advanced Printer Script for Deploying Network Printers
https://kb.stonegroup.co.uk/index.php?View=entry&EntryID=271