Quantcast
Viewing latest article 8
Browse Latest Browse All 10

VBS Script to list the network printers a user is connected to

The below little VBS script is an example of how to pull back a list of network printers a users is connected to.

This script is only pulling back the server and share names but you could retrieve other properties in the same way

http://msdn.microsoft.com/en-us/library/aa394363%28v=vs.85%29.aspx

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colPrinters = objWMIService.ExecQuery ("Select * From Win32_Printer Where Local = False")

If colPrinters.Count <> 0 Then'If there are some network printers
        ForEach objPrinterInstalled In colPrinters ' For each network printer
                msgbox objPrinterInstalled.ServerName & "\"& objPrinterInstalled.ShareName ' Show the server\shar name
        Next
Endif
AttachmentSize
Image may be NSFW.
Clik here to view.
list_network_printers.vbs
388 bytes

Viewing latest article 8
Browse Latest Browse All 10

Trending Articles