Enumerate all printers installed at computer startup (With Startup GPO)

2 views
Skip to first unread message

Tech-Mentor

unread,
May 27, 2010, 5:01:15 PM5/27/10
to VBScript
I add printers the following way so that all users have the printer
available:
oShell.Run("rundll32 printui.dll,PrintUIEntry /ga /q /n\\server
\share", 0, True)

I was able to enumerate all computer installed using the following
code with either XP or 2003:
Set oPrinters = oNetwork.EnumPrinterConnections

But with Windows 7 this method returns 0.

I also tried this:
Set objWMIService = GetObject("winmgmts:
{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery("Select * from
Win32_Printer")

But this return only the "XPS Printer" and nothing else.

How can I retrieve all printer installed on a computer at STARTUP
(Before a user is logged).

I am using a GPO in a Active Directory Domain and I am using a VBS
script at STARTUP.

Thanks!

Reply all
Reply to author
Forward
0 new messages