VBS Clean Printer list

If your looking to delete all the printers via script this is your code.
You can change the SELECT to pick certain printers.

This .vbs can be deployed using GPO as a user login script.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * From Win32_Printer Where ServerName = '\\\\servername'",,48)
For Each objPrinter in colInstalledPrinters

All Printers

("SELECT * FROM Win32_Printer")

All printers where they are offline

("SELECT * FROM Win32_Printer WHERE ExtendedPrinterStatus = 2")



For more select statements please compile them using the information below.



or search for “WMI Win32_Printer class”

Another useful tool is WMI Code Creator.
This will show you the values of current WMI records and build your select.

Print Friendly, PDF & Email
  1. No comments yet.

  1. No trackbacks yet.

Warning: Use of undefined constant cs_print_smilies - assumed 'cs_print_smilies' (this will throw an Error in a future version of PHP) in D:\Domains\ibuddy.info\wwwroot\blog\wp-content\themes\monochrome\comments.php on line 185