Problem locating all Printers in computer...

  • Thread starter Thread starter Vanessa
  • Start date Start date
V

Vanessa

Hi,
I'm trying to loop through all the printers in my computer system using WMI.

However, I found out that it doesn't really get the correct number of
printers in my system.

I have 16 printers in my printers & faxes. However, when I use the WMI to
retrieve the printers in my system, it only retrieve 13 printers instead of
16.

Does anyone know why is this so and how to resolve this issue?

Regards
Vanessa
 
* "Vanessa said:
I'm trying to loop through all the printers in my computer system using WMI.

However, I found out that it doesn't really get the correct number of
printers in my system.

I have 16 printers in my printers & faxes. However, when I use the WMI to
retrieve the printers in my system, it only retrieve 13 printers instead of
16.

Post your code.
 
security. It's possible that for some users, the given printers are not
accessible.

ps: no need to cross post.
 
Dim strPrintServer As String

strPrintServer = "localhost"

Dim WMIObject As String, PrinterSet As Object, Printer As Object

WMIObject = "winmgmts://" & strPrintServer

PrinterSet = GetObject(WMIObject).InstancesOf("win32_Printer")

For Each Printer In PrinterSet

MsgBox(PrinterStatusToString(Printer.printerstatus))

End If

Exit Function

End If

Next Printer
 
Back
Top