Win32_Printer vbscript sample code
The foundations for Manageability in Windows is Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).
ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself. The Win32_Printer WMI class can be used in ActiveXperts Network Monitor to monitor your servers.
Description
The Win32_Printer WMI class represents a device connected to a Windows computer system that can reproduce a visual image on paper or other medium.
Sample Code
On Error Resume Next strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer",,48) For Each objItem in colItems Wscript.Echo "Attributes: " & objItem.Attributes Wscript.Echo "Availability: " & objItem.Availability Wscript.Echo "AveragePagesPerMinute: " & objItem.AveragePagesPerMinute Wscript.Echo "Capabilities: " & objItem.Capabilities Wscript.Echo "CapabilityDescriptions: " & objItem.CapabilityDescriptions Wscript.Echo "Caption: " & objItem.Caption Wscript.Echo "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode Wscript.Echo "ConfigManagerUserConfig: " & objItem.ConfigManagerUserConfig Wscript.Echo "CreationClassName: " & objItem.CreationClassName Wscript.Echo "DefaultPriority: " & objItem.DefaultPriority Wscript.Echo "Description: " & objItem.Description Wscript.Echo "DetectedErrorState: " & objItem.DetectedErrorState Wscript.Echo "DeviceID: " & objItem.DeviceID Wscript.Echo "DriverName: " & objItem.DriverName Wscript.Echo "ErrorCleared: " & objItem.ErrorCleared Wscript.Echo "ErrorDescription: " & objItem.ErrorDescription Wscript.Echo "HorizontalResolution: " & objItem.HorizontalResolution Wscript.Echo "InstallDate: " & objItem.InstallDate Wscript.Echo "JobCountSinceLastReset: " & objItem.JobCountSinceLastReset Wscript.Echo "LanguagesSupported: " & objItem.LanguagesSupported Wscript.Echo "LastErrorCode: " & objItem.LastErrorCode Wscript.Echo "Location: " & objItem.Location Wscript.Echo "Name: " & objItem.Name Wscript.Echo "PaperSizesSupported: " & objItem.PaperSizesSupported Wscript.Echo "PNPDeviceID: " & objItem.PNPDeviceID Wscript.Echo "PortName: " & objItem.PortName Wscript.Echo "PowerManagementCapabilities: " & objItem.PowerManagementCapabilities Wscript.Echo "PowerManagementSupported: " & objItem.PowerManagementSupported Wscript.Echo "PrinterPaperNames: " & objItem.PrinterPaperNames Wscript.Echo "PrinterState: " & objItem.PrinterState Wscript.Echo "PrinterStatus: " & objItem.PrinterStatus Wscript.Echo "PrintJobDataType: " & objItem.PrintJobDataType Wscript.Echo "PrintProcessor: " & objItem.PrintProcessor Wscript.Echo "SeparatorFile: " & objItem.SeparatorFile Wscript.Echo "ServerName: " & objItem.ServerName Wscript.Echo "ShareName: " & objItem.ShareName Wscript.Echo "SpoolEnabled: " & objItem.SpoolEnabled Wscript.Echo "StartTime: " & objItem.StartTime Wscript.Echo "Status: " & objItem.Status Wscript.Echo "StatusInfo: " & objItem.StatusInfo Wscript.Echo "SystemCreationClassName: " & objItem.SystemCreationClassName Wscript.Echo "SystemName: " & objItem.SystemName Wscript.Echo "TimeOfLastReset: " & objItem.TimeOfLastReset Wscript.Echo "UntilTime: " & objItem.UntilTime Wscript.Echo "VerticalResolution: " & objItem.VerticalResolution Next