http://www.mums.ac.ir/shares/hit/eduhit/book/windowsscripting.pdf
http://support.microsoft.com/kb/926352/en-us
https://www.microsoft.com/learning/en-us/book.aspx?id=6789
FilterPrinterStatus.vbs
Option Explicit ‘On Error Resume Next Dim strComputer Dim wmiNS Dim wmiQuery Dim objWMIService Dim colItems Dim objItem Dim strStatus strComputer = "." wmiNS = "\root\cimv2" wmiQuery = "Select * from Win32_Printer" _ & " Where PrinterStatus = 1" _ & " or PrinterStatus = 2" _ & " or PrinterStatus = 7" Set objWMIService = GetObject("winmgmts:\\" _ & strComputer & wmiNS) Set colItems = objWMIService.ExecQuery(wmiQuery) If colItems.Count = 0 Then WScript.Echo "all printers are fine" Else For Each objItem In colItems WScript.Echo "Name: " & objItem.Name WScript.Echo "Location: " & objItem.Location subEvalStatus WScript.Echo "Printer Status: " & strStatus WScript.Echo "Server Name: " & objItem.ServerName WScript.Echo "Share Name: " & objItem.ShareName WScript.Echo Next End If Sub subEvalStatus Select Case objItem.PrinterStatus Case 1 strStatus = "Other" Case 2 strStatus = "Unknown" Case 3 strStatus = "Idle" Case 4 strStatus = "Printing" Case 5 strStatus = "Warmup" Case 6 strStatus = "Stopped Printing" Case 7 strStatus = "Offline" End Select End Sub
Microsoft Windows Scripting Self-Paced Learning Guide,布布扣,bubuko.com
Microsoft Windows Scripting Self-Paced Learning Guide
原文:http://www.cnblogs.com/geovindu/p/3908977.html