General discussion


printer scripts

By TechSerf ·
Windows 2003 Domain, desktops are placed into OUs, OUs have .cmd files that assign network printers. E.g., you're in room 101, so your computer lab gets the printer for room 101, and printers are per machine, not user. We found the printui dll commands worked quite well for this with the /y /ga switches. It runs as a startup script, and works well. However, when we try to add a second printer (e.g., lexmark is default, colour dell is secondary), the colour dell *always* goes default. I've tried removing the /y from the command, tried switching the order of the startup script processing order in group policy, even put pause commands to make sure the lexmark one gets added first, then finishes, then have the dell one.

anyway, bottom line is: has anyone gotten the printui command to work properly with two network globally added printers?


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by bart777 In reply to printer scripts

I have had lots of trouble with that method. It does seem to be hit or miss.

You might want to try Kixtart as a scripting language.

I have had great succes with it.

Here is a sample of one of my printer scripts.

ADDPRINTERCONNECTION ("\\stafp1\Laser99_Doc1")
ADDPRINTERCONNECTION ("\\stafp1\Laser99_Doc2")
SETDEFAULTPRINTER ("\\stafp1\Laser99_Doc1")
If InGroup ("Doc2Print99") = 1
SETDEFAULTPRINTER ("\\stafp1\Laser99_Doc2")

Hope this helps

Collapse -

by TechSerf In reply to

Would that be per user? I need per machine.

Collapse -

by bart777 In reply to printer scripts

You could use the same technique but with a bit of a twist.

Since the machines are all in their in their own OU's just use a simple batch file to call the KIX script. Simply addd it to the policy that you have assigned to that OU. If you do it this way you can still get the desired effect using this better scripting language. I think once you try this method you will be happy.

Let me know how it turns out.

Collapse -

You can try to specifically set the default printer after both are added...

by kcasey In reply to printer scripts

If you're using VBScript, you can try the following found at:

' SetDefaultPrinter.vbs - Windows logon script example
' PrintersDefault.vbs - Set the default printer
' VBScript - to map a network printer
' Author Guy Thomas
' Version 1.4 - April 24th 2005
' -----------------------------------------------------------------'
Option Explicit
Dim objNetwork, strUNCPrinter
strUNCPrinter = "\\LittleServer\HP LaserJet 2420"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter

' Here is where we set the default printer to strUNCPrinter
objNetwork.SetDefaultPrinter strUNCPrinter
WScript.Echo "Check the Printers folder for : " & strUNCPrinter


' End of Guy's Windows logon example VBScript.

Related Discussions

Related Forums