ajbritton Posted August 4, 2006 Share Posted August 4, 2006 I have a script which uses PrintUI.dll to add a per-machine printer. This script runs as a 'startup script', assigned using Group Policy.I have another script which uses WMI to enumerate printer connections and set a default based on certain criteria. When I test the script by running it manually, it enumerates all local and network printers, including the per-machine printer added by the first script. When I assign the script as a logon script however, it does not 'see' the per-machine printer, even though it appears once the logon process is complete.Does anyone know of a good workaround (I can think of a few 'icky' ones)? Link to comment Share on other sites More sharing options...
RogueSpear Posted August 4, 2006 Share Posted August 4, 2006 Microsoft's provided tools for printers management really suck to say the least. After messing around for quite a while, I finally made a common VBscript that is called from individual OU scripts. The common script essentially is one huge case select that calls various subroutines. It isn't elegant or pretty, but it works.The per machine printer has never been reliable for me. Link to comment Share on other sites More sharing options...
mlongoh Posted September 28, 2006 Share Posted September 28, 2006 (edited) I'm doing the same thing you're doing - setting per-machine printers in the startup script and setting the default printer in the logon script. I've got it working.What script are you running to set the default printer? I used the prnmngr.vbs script that is stored in c:\windows\system32 as a reference to create this code to set the per-machine printer as the default printer and it works fine in a logon script. The DefautlPrinter variable is what you would set to the name of your per-machine printer.DefaultPrinter="\\server\printshare"const kNameSpace = "root\cimv2"set oLocator=CreateObject("WbemScripting.SWbemLocator")set oService=oLocator.ConnectServer("", kNameSpace)set oPrinter=oService.Get("Win32_Printer.DeviceID='" & DefaultPrinter & "'")uResult=oPrinter.SetDefaultPrinter Edited September 29, 2006 by mlongoh Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now