2 replies
by martin Accepted solution
by bizzo Accepted solution
Below is a short script to display all printers in the profile:
------------------------
strComputer = "."
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
strPrinterState = objPrinter.PrinterState
WScript.echo strPrinterState
Next
----------------------------------
The main thing you're looking at here is the "PrinterState" http://msdn.microsoft.com/en-us/library/aa394363(VS.85).aspx
This page lists the possible values (1-25),
Then, depending on the current state, you can delete the printer using "RemovePrinterConnection", see http://www.computerperformance.co.uk/Logon/Logon_Remove_Printer.htm
This discussion is closed to new replies.
Trending Networks posts
Sort by Trending