Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Win 2003 R2 setup. I can push the printer via group policy, and pushprinterconnections.exe, but the printer isn't set as the default printer. Any ideas on how to set the default printer for an XP box via group policy?

share|improve this question
add comment

4 Answers

up vote 3 down vote accepted

In the past I've done this using a startup script.

Using wscript:

    Set WSHNetwork = CreateObject("WScript.Network")
    WSHNetwork.SetDefaultPrinter "[PRINTER_NAME]"

Taken from this link

share|improve this answer
    
Nice! Only problem is one of timing. It seems that the printer, pushed from group-policy, isn't yet completey installed when the script runs, as I get an error that the printer doesn't exist. –  WaldenL May 4 '09 at 22:29
    
OK, my bad. I had the script set the default printer as "Canon5000_PCL" which is the printer name... or was it? :-) Printer name is actually "\\<server>\Canon5000_PCL", really helps to have the UNC path in the name. Your solution seems spot on (if one uses the right printer name) :-) –  WaldenL May 5 '09 at 13:04
1  
To make it more flexible, you could create a security group for each printer - and then add the user to one of the printer security groups - having your script checking which printer group the user belongs to, setting that one as default. Instant default printer management with ADUC ^^ –  Oskar Duveborn May 20 '09 at 0:37
    
To add the printer connection, before setting it as default, add: WSH.Network.AddWindowsPrinterConnection("[Printer_UNC_PATH]") –  Nathan Hartley Jun 18 '10 at 14:12
add comment

In your comment on this answer you mention an issue with timing. On our systems I call the script that sets default printers by adding the script under

User Configuration - Templates - System/Logon - Run Programs at Logon

The programs under 'run programs at logon' happen after the profile is done loading, and after windows explorer has started. I am not 100% certain that this will deal with the timing issue in all cases, but it works for me.

share|improve this answer
    
Actually I think it does deal w/the timing issue. See my additional comment to Jimmie. –  WaldenL May 5 '09 at 13:02
add comment

This is a surprisingly annoying problem to solve. The first problem is that the default printer setting is user specific. The second problem like you noted in your comment to Jimmie is that even with a per-user login script, there are timing issues where the printer doesn't technically exist yet or the HKCU hive hasn't finished loading.

What we ended up doing in our situation is basically using a login script that loops looking for the printer to exist before it tries to set it as default. If it can't find it after a certain amount of time, it just gives up.

share|improve this answer
add comment

We have school districts using R2 printing deployment for labs. To combat this left out function from R2 we use Kixtart to help. This will help is you deploy printers for users in specific labs. This will also provide the delay needed to wait for windows to add the printer.

Labs have a naming convention. HS101-01, HS101-02, HS102-01, HS102-02, etc

Using a kixtart startup script from a Group Policy Object we have kix32.exe execute this script below.

;Capture room number
$pos = INSTR(@WkSta, "-");
IF $pos > 0
    $Room = LEFT(@WkSta, ($pos - 1));
    ; ? $Room
ELSE
    $Room = @WkSta;
ENDIF


SLEEP 45   ; Give the computer time to log in and add the printer

;;;;;;;;;;;;; BEGIN PRINTER DEFAULTS LIST ;;;;;;;;;;;;

SELECT

    Case $Room = "HS71"
    	SetDefaultPrinter("\\nebsdfs\HS71 - HP LaserJet 4100 Series PCL")

    Case $Room = "HS086"
    	SetDefaultPrinter("\\nebsdfs\HS086 - HP LaserJet 4000")

    Case $Room = "ES102"
    	SetDefaultPrinter("\\nebsdfs\ES102 - HP LaserJet 4000")


ENDSELECT

;;;;;;;;;;;;;; END PRINTER DEFAULTS LIST ;;;;;;;;;;;;;

I hope this will help. Thanks.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.