Quantcast
Channel: Geeks Hangout - Code
Viewing all articles
Browse latest Browse all 10

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

$
0
0

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
list_network_printers.vbs388 bytes

Viewing all articles
Browse latest Browse all 10

Trending Articles