Using EMI for remote printer info

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Conic Ellipse (ConicEllipse_at_discussions.microsoft.com)
Date: 12/22/04


Date: Wed, 22 Dec 2004 06:21:01 -0800

Howdy all. I used Scriptomatic to create a script that will show me all about
printers installed on a machine using WMI. The script works on my machine,
but when I try to use it on another workstation on my enterprise, I only get
information about 'software' printers on the machine and not the network
printers they have attached to them. Again, I can see the network printers
when I run it on mine, but not on theirs (by putting in their machine name in
place of the . for the strComputer name while running the script on my
computer.)

Remote servers actually show correct information. It appears to be just
workstations that are not working.

Any ideas on how I can correctly get the data from the 'remote' workstations?

Thanks, here's a snipet from the Scriptomatic:

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer",,48)
For Each objItem in colItems
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "DriverName: " & objItem.DriverName
    Wscript.Echo "ShareName: " & objItem.ShareName
Next

If it matters, it is failing on remote machines using Windows 2000 up to SP4
AND Windows XP SP1 and 2.

-=Conic=-



Relevant Pages

  • Re: script to install printers based on location attribute
    ... the main body of workstations and printers. ... I don't anticipate any run-time performance issues with this script. ... perform an ADSI query for the UNCNAME attribute of the>> printer and use WMI to install the printer connection to the users> profile. ...
    (microsoft.public.windows.server.scripting)
  • Re: script to install printers based on location attribute
    ... the main body of workstations and printers. ... I don't anticipate any run-time performance issues with this script. ... perform an ADSI query for the UNCNAME attribute of the>> printer and use WMI to install the printer connection to the users> profile. ...
    (microsoft.public.win2000.printing)
  • Re: How to execute remote vbscript
    ... I'm trying to get a list of network mapped printers on all of the ... workstations in our domain and put into a file. ... local vbs script that is trying to be executed and the script from the ... Below script runs and tries to execute a script on each workstation ...
    (microsoft.public.scripting.vbscript)
  • Re: Domain Logon Script Advice
    ... users printers and network shares based upon which Active Directory OU ... I happy with deploying the script via GPO etc, ... A very basic VBScript logon script to map the same printer and shares to all ...
    (microsoft.public.scripting.wsh)
  • Re: script to install printers based on location attribute
    ... > printers with the general vicinity of the workstation. ... > The following would be the general flow of the script. ... > through each one to create the printer connection that I don't know how to ... result from relocating printers and/or workstations, ...
    (microsoft.public.windows.server.scripting)