Enumerating All Printers, Including Network Printers

P

Phil Galey

Is there any way of enumerating all printers, including network printers in VB.NET?

printing.PrinterSettings.InstalledPrinters only enumerates printers attached to the local workstation. Thanks.
 
K

Ken Tucker [MVP]

Hi,

Add a reference to system.management.dll to your app. See
Win32_Printer for more info.


Private Sub GetPrinters()

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_Printer")

moReturn = moSearch.Get

For Each mo In moReturn

Debug.WriteLine(mo("Name"))

Next

End Sub

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top