Re: Enumerate Printers for local user profiles????
From: Chung-Wei Foong [MSFT] (chungwf_at_online.microsoft.com)
Date: 05/17/04
- Previous message: [MS] Scott McNairy: "Re: WBEM Implementations in Windows"
- In reply to: jackal31: "Enumerate Printers for local user profiles????"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 17 May 2004 11:21:07 -0700
One possible solution is, if you have another machine and know all the user
names and password on your local machine, you can enumerate the instances
for the printers. The following is a sample.
strComputer="MachineName"
strUserName=".\UserName"
strPassword="Password"
Set Locator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = Locator.ConnectServer(strComputer, "root\cimv2",
strUserName, strPassword)
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select DeviceID, Caption, DriverName, ServerName, ShareName from
Win32_Printer")
For Each objPrinter in colInstalledPrinters
Wscript.Echo "DeviceID: " & objPrinter.DeviceID
Wscript.Echo "Caption: " & objPrinter.Caption
Wscript.Echo "ServerName: " & objPrinter.ServerName
Wscript.Echo "ShareName: " & objPrinter.ShareName
Wscript.Echo "DriverName: " & objPrinter.DriverName
Next
-- This posting is provided "AS IS" with no warranties, and confers no rights. Use of any included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm "jackal31" <pmein@jccc.net> wrote in message news:a91ed33b.0405130845.8c168d2@posting.google.com... >I posted earlier and have narrowed down my problem for showing > connected printers. I connect to wmi via a local Administrator > account but need to enumerated printers for the other user profiles on > the workstation. I can get a list of the local users using "Select * > from Win32_UserAccount Where LocalAccount = True" but then how would I > enumerate their printers from "Select * from Win32_Printer" > > A snippet of sample code would be appreciated... thanks > > philip
- Previous message: [MS] Scott McNairy: "Re: WBEM Implementations in Windows"
- In reply to: jackal31: "Enumerate Printers for local user profiles????"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|