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
        For Each objPrinterInstalled In colPrinters ' For each network printer
                msgbox objPrinterInstalled.ServerName & "\" & objPrinterInstalled.ShareName ' Show the server\shar name
        Next
End if

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.