I have scripted ListPrinters.vbs to return all the printers and their locations that a client has access to.
The syntax for using ListPrinters.vbs is:
cscript //nologo <Drive:>\Folder\ListPrinters.vbs
The console output is in CSV format. Here is a sample:
"ScanSoft PDF Create!","" "NUL","" "HP Officejet 6200 series fax","" "HP Officejet 6200 series","" "Generic / Text Only","" "File Print FedEx Kinko's","FedEx Kinko's" "\\JSI001\HP Business Inkjet 2250 (PCL5C)","HDQ Printer Room" "\\JSI001\ZFax","Courier"If you wanted to process this list in a batch file, use:
for /f Token=1* Delims=," %%a in ('cscript //nologo <Drive:>\Folder\ListPrinters.vbs') do ( set prt=%%a set loc=%%b . . . . )ListPrinters.vbs contains:
strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "\{impersonationLevel=impersonate\}!\\" & strComputer & "\root\cimv2") Set iPrt = objWMIService.ExecQuery ("Select * from Win32_Printer") For Each objPrinter in iPrt Wscript.Echo," &objPrinter.Name & " Next& objPrinter.Location &
0 comments
Hide comments