Setting the Default Printer when Deploying Printers

I have a client that wants to deploy printers using group policy.
Windows 2003 R2 Active Directory has this capability, all you need is at least one 2003 R2 domain controller.

Most of what you need can be found here, but there are a few things I found out in real life.

First, I found out that it doesn’t work when assigning printers to users via group policy, but it does work when assigning them to computers. That’s ok for me, because my clients care about assigning printers to computers, not users. By that I mean we want the printer in Room 212 assigned to the computers in Room 212, no matter who sits down and logs on.

One missing function of deploying printers via group policy is assigning the default printer. So this is one of the main reasons I write this blog entry.

In order to assign the default printer, we have to take the group policy that assigns the printer and run a script when the user logs on (no matter who the user is)

In order to make this happen, we have to turn on a very important feature in group policy called “loopback” mode. Loopback mode allows you to assign a group policy to a workstation, and not only run the “computer configuration” portion, but also run the “User Configuration” portion when the user, no matter who it is, logs on.


Here are the three things this group policy does.

The “pushprinterconnections.exe” I copied from the W2003 R2 server (c:\windows\system32) to the NETLOGON share on any of the domain controllers. This needs to run on all XP machines in order to push printer using group policy. Vista does not need this (like who uses vista…?) This piece is explained well in the link i provided at the top of the blog.

The Loopback mode is set to Enabled and Merge. The Merge setting (rather than Replace) still allows group policies assigned to user to work and apply.

The Script to set the default printer, is called “Default-Printer.vbs”

The contents of the “Default-Printer.vbs” is seen below

‘ Set Default Printers
Wscript.Sleep 30000
defaultP = WScript.Arguments.Item(0)
Set WshNetwork = CreateObject("Wscript.Network")
WshNetwork.SetDefaultPrinter "\\server-name\" & defaultP

The nice thing about this script is that you can have ONE script to set the default printer for any printer. The implementation of this script is seen below, you type the printer name in the “Script Parameters” field, this is what the “Item(0)” is all about in the script. Item(0) is like %1 in the old dos batch programming.

Also, I found that the Wscript.Sleep 30000, which means to pause for 30 seconds, allows the group policy to deploy the printers. If i didn’t wait this long, then it sometimes errors out (on a new profile) because the printer is not finished installing and the script errors out because the printer is not seen as installed yet.


It works pretty well. My clients have a group policy assigned for each printer or groups of printers, they put the computer objects in OUs and assign the group policies to those OUs. For example, all the workstations in room 112 are in an OU called Room112, which has the group policy PrinterRoom112 assigned to it. This group policy assigns the printer or printers in room 112 to all these workstations, no matter who logs on.


Author: Mike

owner of blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s