All of my network printers are not accessable via VB Script...

By LarryD4 ·
Well not really but here is my problem.

Below is the classic VB Script to list printers on a Windows 2K PC and above.

I have been createing an IT Tool that will allow an analyst to list, add, delete, and set as default, printers on a users PC on our network.

Last week the below script was working fine. It would list all the printers on a persons PC, including the network printers. Yes I am the admin of the network but I am not the Domain Admin, since there is a level above me where the domain admins are for the entire enterprise.

Suddenly on Monday of this week this part of the script just stopped working.

It will list printers on a users PC that are local(USB/LPT) to the PC but any network printers that are installed do not show up.

As far as I know, no major changes were made to GP as far as permissions, so I can only assume this is a patch issue.

Has anyone else ever encountered this or has an idea as to why??

Set objNetwork = CreateObject("Wscript.Network")

strName = objNetwork.UserName
strDomain = objNetwork.UserDomain
strUser = strDomain & "\" & strName

strText = strUser & VbCrLf
strComputer = "PCMIDLED"

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colPrinters = objWMIService.ExecQuery ("Select * From Win32_Printer")

For Each objPrinter In colPrinters
WScript.Echo objPrinter.Name & vbCrLf

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums