Re: Enumerate Printers for local user profiles????

From: Chung-Wei Foong [MSFT] (chungwf_at_online.microsoft.com)
Date: 05/17/04

  • Next message: Ryan Nordman: "Modifying Folder Security Settings"
    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 
    

  • Next message: Ryan Nordman: "Modifying Folder Security Settings"

    Relevant Pages

    • Win32_Printer remote enumeration??
      ... I am trying to use VBSCRIPT and WMI to enumerate all printers ... Set colInstalledPrinters = objWMIService.ExecQuery _ ...
      (microsoft.public.win32.programmer.wmi)
    • Re: How to enumerate network printers
      ... By combining the MSDN examples for NetServerEnum and NetShareEnum I was able to write a program that does enumerate the computers and printers on the network. ...
      (microsoft.public.vc.mfc)
    • Re: Setting up printers
      ... just select from the list of users you added to the local machine. ... Printer Connections are a per user setting. ... Computer Configuration, Windows Settings, Deployed Printers ... I then created user def and when I log in I see the printers that I ...
      (microsoft.public.windows.server.general)
    • Re: Enumerating Local Physical Printers
      ... writers and fax drivers masquerading as printers are also turned up in ... drivers by looking at the PRINTER_ATTRIBUTE_FAX bit of the Attributes ... Did you try using the following API to enumerate the ... locally installed printers: ...
      (microsoft.public.win32.programmer.wmi)
    • Re: Enumerating Printer Drivers Help Please
      ... > I need to be able to Enumerate through Printer Drivers, ports, printers ... And even add printers, ports, and drivers and setup ...
      (microsoft.public.dotnet.languages.csharp)