Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » WMI Performance Counters » Python

Printer - WMI sample in Python

The foundations for Manageability in Windows 2019/2012/2008/ and Windows 10/8/7/Vista/XP are 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.

On this site, you can find many WMI samples.

The Printer WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Printer

Example(s)

from win32com.client import GetObject
objWMI = GetObject('winmgmts:').InstancesOf('CIM_Printer')

for obj in objWMI:
	if obj.Attributes != None:
		print("Attributes:" + str(obj.Attributes))
	if obj.Availability != None:
		print("Availability:" + str(obj.Availability))
	if obj.AvailableJobSheets != None:
		print("AvailableJobSheets:" + str(obj.AvailableJobSheets))
	if obj.AveragePagesPerMinute != None:
		print("AveragePagesPerMinute:" + str(obj.AveragePagesPerMinute))
	if obj.Capabilities != None:
		print("Capabilities:" + str(obj.Capabilities))
	if obj.CapabilityDescriptions != None:
		print("CapabilityDescriptions:" + str(obj.CapabilityDescriptions))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.CharSetsSupported != None:
		print("CharSetsSupported:" + str(obj.CharSetsSupported))
	if obj.Comment != None:
		print("Comment:" + str(obj.Comment))
	if obj.ConfigManagerErrorCode != None:
		print("ConfigManagerErrorCode:" + str(obj.ConfigManagerErrorCode))
	if obj.ConfigManagerUserConfig != None:
		print("ConfigManagerUserConfig:" + str(obj.ConfigManagerUserConfig))
	if obj.CreationClassName != None:
		print("CreationClassName:" + str(obj.CreationClassName))
	if obj.CurrentCapabilities != None:
		print("CurrentCapabilities:" + str(obj.CurrentCapabilities))
	if obj.CurrentCharSet != None:
		print("CurrentCharSet:" + str(obj.CurrentCharSet))
	if obj.CurrentLanguage != None:
		print("CurrentLanguage:" + str(obj.CurrentLanguage))
	if obj.CurrentMimeType != None:
		print("CurrentMimeType:" + str(obj.CurrentMimeType))
	if obj.CurrentNaturalLanguage != None:
		print("CurrentNaturalLanguage:" + str(obj.CurrentNaturalLanguage))
	if obj.CurrentPaperType != None:
		print("CurrentPaperType:" + str(obj.CurrentPaperType))
	if obj.Default != None:
		print("Default:" + str(obj.Default))
	if obj.DefaultCapabilities != None:
		print("DefaultCapabilities:" + str(obj.DefaultCapabilities))
	if obj.DefaultCopies != None:
		print("DefaultCopies:" + str(obj.DefaultCopies))
	if obj.DefaultLanguage != None:
		print("DefaultLanguage:" + str(obj.DefaultLanguage))
	if obj.DefaultMimeType != None:
		print("DefaultMimeType:" + str(obj.DefaultMimeType))
	if obj.DefaultNumberUp != None:
		print("DefaultNumberUp:" + str(obj.DefaultNumberUp))
	if obj.DefaultPaperType != None:
		print("DefaultPaperType:" + str(obj.DefaultPaperType))
	if obj.DefaultPriority != None:
		print("DefaultPriority:" + str(obj.DefaultPriority))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.DetectedErrorState != None:
		print("DetectedErrorState:" + str(obj.DetectedErrorState))
	if obj.DeviceID != None:
		print("DeviceID:" + str(obj.DeviceID))
	if obj.Direct != None:
		print("Direct:" + str(obj.Direct))
	if obj.DoCompleteFirst != None:
		print("DoCompleteFirst:" + str(obj.DoCompleteFirst))
	if obj.DriverName != None:
		print("DriverName:" + str(obj.DriverName))
	if obj.EnableBIDI != None:
		print("EnableBIDI:" + str(obj.EnableBIDI))
	if obj.EnableDevQueryPrint != None:
		print("EnableDevQueryPrint:" + str(obj.EnableDevQueryPrint))
	if obj.ErrorCleared != None:
		print("ErrorCleared:" + str(obj.ErrorCleared))
	if obj.ErrorDescription != None:
		print("ErrorDescription:" + str(obj.ErrorDescription))
	if obj.ErrorInformation != None:
		print("ErrorInformation:" + str(obj.ErrorInformation))
	if obj.ExtendedDetectedErrorState != None:
		print("ExtendedDetectedErrorState:" + str(obj.ExtendedDetectedErrorState))
	if obj.ExtendedPrinterStatus != None:
		print("ExtendedPrinterStatus:" + str(obj.ExtendedPrinterStatus))
	if obj.Hidden != None:
		print("Hidden:" + str(obj.Hidden))
	if obj.HorizontalResolution != None:
		print("HorizontalResolution:" + str(obj.HorizontalResolution))
	if obj.InstallDate != None:
		print("InstallDate:" + str(obj.InstallDate))
	if obj.JobCountSinceLastReset != None:
		print("JobCountSinceLastReset:" + str(obj.JobCountSinceLastReset))
	if obj.KeepPrintedJobs != None:
		print("KeepPrintedJobs:" + str(obj.KeepPrintedJobs))
	if obj.LanguagesSupported != None:
		print("LanguagesSupported:" + str(obj.LanguagesSupported))
	if obj.LastErrorCode != None:
		print("LastErrorCode:" + str(obj.LastErrorCode))
	if obj.Local != None:
		print("Local:" + str(obj.Local))
	if obj.Location != None:
		print("Location:" + str(obj.Location))
	if obj.MarkingTechnology != None:
		print("MarkingTechnology:" + str(obj.MarkingTechnology))
	if obj.MaxCopies != None:
		print("MaxCopies:" + str(obj.MaxCopies))
	if obj.MaxNumberUp != None:
		print("MaxNumberUp:" + str(obj.MaxNumberUp))
	if obj.MaxSizeSupported != None:
		print("MaxSizeSupported:" + str(obj.MaxSizeSupported))
	if obj.MimeTypesSupported != None:
		print("MimeTypesSupported:" + str(obj.MimeTypesSupported))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.NaturalLanguagesSupported != None:
		print("NaturalLanguagesSupported:" + str(obj.NaturalLanguagesSupported))
	if obj.Network != None:
		print("Network:" + str(obj.Network))
	if obj.PaperSizesSupported != None:
		print("PaperSizesSupported:" + str(obj.PaperSizesSupported))
	if obj.PaperTypesAvailable != None:
		print("PaperTypesAvailable:" + str(obj.PaperTypesAvailable))
	if obj.Parameters != None:
		print("Parameters:" + str(obj.Parameters))
	if obj.PNPDeviceID != None:
		print("PNPDeviceID:" + str(obj.PNPDeviceID))
	if obj.PortName != None:
		print("PortName:" + str(obj.PortName))
	if obj.PowerManagementCapabilities != None:
		print("PowerManagementCapabilities:" + str(obj.PowerManagementCapabilities))
	if obj.PowerManagementSupported != None:
		print("PowerManagementSupported:" + str(obj.PowerManagementSupported))
	if obj.PrinterPaperNames != None:
		print("PrinterPaperNames:" + str(obj.PrinterPaperNames))
	if obj.PrinterState != None:
		print("PrinterState:" + str(obj.PrinterState))
	if obj.PrinterStatus != None:
		print("PrinterStatus:" + str(obj.PrinterStatus))
	if obj.PrintJobDataType != None:
		print("PrintJobDataType:" + str(obj.PrintJobDataType))
	if obj.PrintProcessor != None:
		print("PrintProcessor:" + str(obj.PrintProcessor))
	if obj.Priority != None:
		print("Priority:" + str(obj.Priority))
	if obj.Published != None:
		print("Published:" + str(obj.Published))
	if obj.Queued != None:
		print("Queued:" + str(obj.Queued))
	if obj.RawOnly != None:
		print("RawOnly:" + str(obj.RawOnly))
	if obj.SeparatorFile != None:
		print("SeparatorFile:" + str(obj.SeparatorFile))
	if obj.ServerName != None:
		print("ServerName:" + str(obj.ServerName))
	if obj.Shared != None:
		print("Shared:" + str(obj.Shared))
	if obj.ShareName != None:
		print("ShareName:" + str(obj.ShareName))
	if obj.SpoolEnabled != None:
		print("SpoolEnabled:" + str(obj.SpoolEnabled))
	if obj.StartTime != None:
		print("StartTime:" + str(obj.StartTime))
	if obj.Status != None:
		print("Status:" + str(obj.Status))
	if obj.StatusInfo != None:
		print("StatusInfo:" + str(obj.StatusInfo))
	if obj.SystemCreationClassName != None:
		print("SystemCreationClassName:" + str(obj.SystemCreationClassName))
	if obj.SystemName != None:
		print("SystemName:" + str(obj.SystemName))
	if obj.TimeOfLastReset != None:
		print("TimeOfLastReset:" + str(obj.TimeOfLastReset))
	if obj.UntilTime != None:
		print("UntilTime:" + str(obj.UntilTime))
	if obj.VerticalResolution != None:
		print("VerticalResolution:" + str(obj.VerticalResolution))
	if obj.WorkOffline != None:
		print("WorkOffline:" + str(obj.WorkOffline))
	print("")
	print("########")
	print("")