Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » WMI » python sample

Win32_PerfRawData_VmTaskManagerStats python 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_PerfRawData_VmTaskManagerStats WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Sample Code

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

for obj in objWMI:
	if obj.AddResourcesVirtualMachineTasksCompleted != None:
		print("AddResourcesVirtualMachineTasksCompleted:" + str(obj.AddResourcesVirtualMachineTasksCompleted))
	if obj.AddResourcesVirtualMachineTasksinProgress != None:
		print("AddResourcesVirtualMachineTasksinProgress:" + str(obj.AddResourcesVirtualMachineTasksinProgress))
	if obj.AddResourcesVirtualMachineTasksRecentTime != None:
		print("AddResourcesVirtualMachineTasksRecentTime:" + str(obj.AddResourcesVirtualMachineTasksRecentTime))
	if obj.ApplySnapshotVirtualMachineTasksCompleted != None:
		print("ApplySnapshotVirtualMachineTasksCompleted:" + str(obj.ApplySnapshotVirtualMachineTasksCompleted))
	if obj.ApplySnapshotVirtualMachineTasksinProgress != None:
		print("ApplySnapshotVirtualMachineTasksinProgress:" + str(obj.ApplySnapshotVirtualMachineTasksinProgress))
	if obj.ApplySnapshotVirtualMachineTasksRecentTime != None:
		print("ApplySnapshotVirtualMachineTasksRecentTime:" + str(obj.ApplySnapshotVirtualMachineTasksRecentTime))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.CloneVirtualMachineTasksCompleted != None:
		print("CloneVirtualMachineTasksCompleted:" + str(obj.CloneVirtualMachineTasksCompleted))
	if obj.CloneVirtualMachineTasksinProgress != None:
		print("CloneVirtualMachineTasksinProgress:" + str(obj.CloneVirtualMachineTasksinProgress))
	if obj.CloneVirtualMachineTasksRecentTime != None:
		print("CloneVirtualMachineTasksRecentTime:" + str(obj.CloneVirtualMachineTasksRecentTime))
	if obj.CreateVSSSnapshotSetTasksCompleted != None:
		print("CreateVSSSnapshotSetTasksCompleted:" + str(obj.CreateVSSSnapshotSetTasksCompleted))
	if obj.CreateVSSSnapshotSetTasksinProgress != None:
		print("CreateVSSSnapshotSetTasksinProgress:" + str(obj.CreateVSSSnapshotSetTasksinProgress))
	if obj.CreateVSSSnapshotSetTasksRecentTime != None:
		print("CreateVSSSnapshotSetTasksRecentTime:" + str(obj.CreateVSSSnapshotSetTasksRecentTime))
	if obj.DefineVirtualMachineTasksCompleted != None:
		print("DefineVirtualMachineTasksCompleted:" + str(obj.DefineVirtualMachineTasksCompleted))
	if obj.DefineVirtualMachineTasksinProgress != None:
		print("DefineVirtualMachineTasksinProgress:" + str(obj.DefineVirtualMachineTasksinProgress))
	if obj.DefineVirtualMachineTasksRecentTime != None:
		print("DefineVirtualMachineTasksRecentTime:" + str(obj.DefineVirtualMachineTasksRecentTime))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.DestroySnapshotVirtualMachineTasksCompleted != None:
		print("DestroySnapshotVirtualMachineTasksCompleted:" + str(obj.DestroySnapshotVirtualMachineTasksCompleted))
	if obj.DestroySnapshotVirtualMachineTasksinProgress != None:
		print("DestroySnapshotVirtualMachineTasksinProgress:" + str(obj.DestroySnapshotVirtualMachineTasksinProgress))
	if obj.DestroySnapshotVirtualMachineTasksRecentTime != None:
		print("DestroySnapshotVirtualMachineTasksRecentTime:" + str(obj.DestroySnapshotVirtualMachineTasksRecentTime))
	if obj.DestroyVirtualMachineTasksCompleted != None:
		print("DestroyVirtualMachineTasksCompleted:" + str(obj.DestroyVirtualMachineTasksCompleted))
	if obj.DestroyVirtualMachineTasksinProgress != None:
		print("DestroyVirtualMachineTasksinProgress:" + str(obj.DestroyVirtualMachineTasksinProgress))
	if obj.DestroyVirtualMachineTasksRecentTime != None:
		print("DestroyVirtualMachineTasksRecentTime:" + str(obj.DestroyVirtualMachineTasksRecentTime))
	if obj.ExportVirtualMachineTasksCompleted != None:
		print("ExportVirtualMachineTasksCompleted:" + str(obj.ExportVirtualMachineTasksCompleted))
	if obj.ExportVirtualMachineTasksinProgress != None:
		print("ExportVirtualMachineTasksinProgress:" + str(obj.ExportVirtualMachineTasksinProgress))
	if obj.ExportVirtualMachineTasksRecentTime != None:
		print("ExportVirtualMachineTasksRecentTime:" + str(obj.ExportVirtualMachineTasksRecentTime))
	if obj.Frequency_Object != None:
		print("Frequency_Object:" + str(obj.Frequency_Object))
	if obj.Frequency_PerfTime != None:
		print("Frequency_PerfTime:" + str(obj.Frequency_PerfTime))
	if obj.Frequency_Sys100NS != None:
		print("Frequency_Sys100NS:" + str(obj.Frequency_Sys100NS))
	if obj.ImportVirtualMachineTasksCompleted != None:
		print("ImportVirtualMachineTasksCompleted:" + str(obj.ImportVirtualMachineTasksCompleted))
	if obj.ImportVirtualMachineTasksinProgress != None:
		print("ImportVirtualMachineTasksinProgress:" + str(obj.ImportVirtualMachineTasksinProgress))
	if obj.ImportVirtualMachineTasksRecentTime != None:
		print("ImportVirtualMachineTasksRecentTime:" + str(obj.ImportVirtualMachineTasksRecentTime))
	if obj.MergeDiskTasksCompleted != None:
		print("MergeDiskTasksCompleted:" + str(obj.MergeDiskTasksCompleted))
	if obj.MergeDiskTasksinProgress != None:
		print("MergeDiskTasksinProgress:" + str(obj.MergeDiskTasksinProgress))
	if obj.MergeDiskTasksRecentTime != None:
		print("MergeDiskTasksRecentTime:" + str(obj.MergeDiskTasksRecentTime))
	if obj.MigrateVirtualMachineTasksCompleted != None:
		print("MigrateVirtualMachineTasksCompleted:" + str(obj.MigrateVirtualMachineTasksCompleted))
	if obj.MigrateVirtualMachineTasksinProgress != None:
		print("MigrateVirtualMachineTasksinProgress:" + str(obj.MigrateVirtualMachineTasksinProgress))
	if obj.MigrateVirtualMachineTasksRecentTime != None:
		print("MigrateVirtualMachineTasksRecentTime:" + str(obj.MigrateVirtualMachineTasksRecentTime))
	if obj.ModifyResourcesVirtualMachineTasksCompleted != None:
		print("ModifyResourcesVirtualMachineTasksCompleted:" + str(obj.ModifyResourcesVirtualMachineTasksCompleted))
	if obj.ModifyResourcesVirtualMachineTasksinProgress != None:
		print("ModifyResourcesVirtualMachineTasksinProgress:" + str(obj.ModifyResourcesVirtualMachineTasksinProgress))
	if obj.ModifyResourcesVirtualMachineTasksRecentTime != None:
		print("ModifyResourcesVirtualMachineTasksRecentTime:" + str(obj.ModifyResourcesVirtualMachineTasksRecentTime))
	if obj.ModifyServiceSettingsTasksCompleted != None:
		print("ModifyServiceSettingsTasksCompleted:" + str(obj.ModifyServiceSettingsTasksCompleted))
	if obj.ModifyServiceSettingsTasksinProgress != None:
		print("ModifyServiceSettingsTasksinProgress:" + str(obj.ModifyServiceSettingsTasksinProgress))
	if obj.ModifyServiceSettingsTasksRecentTime != None:
		print("ModifyServiceSettingsTasksRecentTime:" + str(obj.ModifyServiceSettingsTasksRecentTime))
	if obj.ModifyVirtualMachineTasksCompleted != None:
		print("ModifyVirtualMachineTasksCompleted:" + str(obj.ModifyVirtualMachineTasksCompleted))
	if obj.ModifyVirtualMachineTasksinProgress != None:
		print("ModifyVirtualMachineTasksinProgress:" + str(obj.ModifyVirtualMachineTasksinProgress))
	if obj.ModifyVirtualMachineTasksRecentTime != None:
		print("ModifyVirtualMachineTasksRecentTime:" + str(obj.ModifyVirtualMachineTasksRecentTime))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.PauseVirtualMachineTasksCompleted != None:
		print("PauseVirtualMachineTasksCompleted:" + str(obj.PauseVirtualMachineTasksCompleted))
	if obj.PauseVirtualMachineTasksinProgress != None:
		print("PauseVirtualMachineTasksinProgress:" + str(obj.PauseVirtualMachineTasksinProgress))
	if obj.PauseVirtualMachineTasksRecentTime != None:
		print("PauseVirtualMachineTasksRecentTime:" + str(obj.PauseVirtualMachineTasksRecentTime))
	if obj.RemoveResourcesVirtualMachineTasksCompleted != None:
		print("RemoveResourcesVirtualMachineTasksCompleted:" + str(obj.RemoveResourcesVirtualMachineTasksCompleted))
	if obj.RemoveResourcesVirtualMachineTasksinProgress != None:
		print("RemoveResourcesVirtualMachineTasksinProgress:" + str(obj.RemoveResourcesVirtualMachineTasksinProgress))
	if obj.RemoveResourcesVirtualMachineTasksRecentTime != None:
		print("RemoveResourcesVirtualMachineTasksRecentTime:" + str(obj.RemoveResourcesVirtualMachineTasksRecentTime))
	if obj.ResetVirtualMachineTasksCompleted != None:
		print("ResetVirtualMachineTasksCompleted:" + str(obj.ResetVirtualMachineTasksCompleted))
	if obj.ResetVirtualMachineTasksinProgress != None:
		print("ResetVirtualMachineTasksinProgress:" + str(obj.ResetVirtualMachineTasksinProgress))
	if obj.ResetVirtualMachineTasksRecentTime != None:
		print("ResetVirtualMachineTasksRecentTime:" + str(obj.ResetVirtualMachineTasksRecentTime))
	if obj.RestoreVirtualMachineTasksCompleted != None:
		print("RestoreVirtualMachineTasksCompleted:" + str(obj.RestoreVirtualMachineTasksCompleted))
	if obj.RestoreVirtualMachineTasksinProgress != None:
		print("RestoreVirtualMachineTasksinProgress:" + str(obj.RestoreVirtualMachineTasksinProgress))
	if obj.RestoreVirtualMachineTasksRecentTime != None:
		print("RestoreVirtualMachineTasksRecentTime:" + str(obj.RestoreVirtualMachineTasksRecentTime))
	if obj.ResumeVirtualMachineTasksCompleted != None:
		print("ResumeVirtualMachineTasksCompleted:" + str(obj.ResumeVirtualMachineTasksCompleted))
	if obj.ResumeVirtualMachineTasksinProgress != None:
		print("ResumeVirtualMachineTasksinProgress:" + str(obj.ResumeVirtualMachineTasksinProgress))
	if obj.ResumeVirtualMachineTasksRecentTime != None:
		print("ResumeVirtualMachineTasksRecentTime:" + str(obj.ResumeVirtualMachineTasksRecentTime))
	if obj.SaveVirtualMachineTasksCompleted != None:
		print("SaveVirtualMachineTasksCompleted:" + str(obj.SaveVirtualMachineTasksCompleted))
	if obj.SaveVirtualMachineTasksinProgress != None:
		print("SaveVirtualMachineTasksinProgress:" + str(obj.SaveVirtualMachineTasksinProgress))
	if obj.SaveVirtualMachineTasksRecentTime != None:
		print("SaveVirtualMachineTasksRecentTime:" + str(obj.SaveVirtualMachineTasksRecentTime))
	if obj.ShutdownVirtualMachineTasksCompleted != None:
		print("ShutdownVirtualMachineTasksCompleted:" + str(obj.ShutdownVirtualMachineTasksCompleted))
	if obj.ShutdownVirtualMachineTasksinProgress != None:
		print("ShutdownVirtualMachineTasksinProgress:" + str(obj.ShutdownVirtualMachineTasksinProgress))
	if obj.ShutdownVirtualMachineTasksRecentTime != None:
		print("ShutdownVirtualMachineTasksRecentTime:" + str(obj.ShutdownVirtualMachineTasksRecentTime))
	if obj.SnapshotVirtualMachineTasksCompleted != None:
		print("SnapshotVirtualMachineTasksCompleted:" + str(obj.SnapshotVirtualMachineTasksCompleted))
	if obj.SnapshotVirtualMachineTasksinProgress != None:
		print("SnapshotVirtualMachineTasksinProgress:" + str(obj.SnapshotVirtualMachineTasksinProgress))
	if obj.SnapshotVirtualMachineTasksRecentTime != None:
		print("SnapshotVirtualMachineTasksRecentTime:" + str(obj.SnapshotVirtualMachineTasksRecentTime))
	if obj.StartVirtualMachineTasksCompleted != None:
		print("StartVirtualMachineTasksCompleted:" + str(obj.StartVirtualMachineTasksCompleted))
	if obj.StartVirtualMachineTasksinProgress != None:
		print("StartVirtualMachineTasksinProgress:" + str(obj.StartVirtualMachineTasksinProgress))
	if obj.StartVirtualMachineTasksRecentTime != None:
		print("StartVirtualMachineTasksRecentTime:" + str(obj.StartVirtualMachineTasksRecentTime))
	if obj.Timestamp_Object != None:
		print("Timestamp_Object:" + str(obj.Timestamp_Object))
	if obj.Timestamp_PerfTime != None:
		print("Timestamp_PerfTime:" + str(obj.Timestamp_PerfTime))
	if obj.Timestamp_Sys100NS != None:
		print("Timestamp_Sys100NS:" + str(obj.Timestamp_Sys100NS))
	if obj.WaitingtoStartVirtualMachineTasksCompleted != None:
		print("WaitingtoStartVirtualMachineTasksCompleted:" + str(obj.WaitingtoStartVirtualMachineTasksCompleted))
	if obj.WaitingtoStartVirtualMachineTasksinProgress != None:
		print("WaitingtoStartVirtualMachineTasksinProgress:" + str(obj.WaitingtoStartVirtualMachineTasksinProgress))
	if obj.WaitingtoStartVirtualMachineTasksRecentTime != None:
		print("WaitingtoStartVirtualMachineTasksRecentTime:" + str(obj.WaitingtoStartVirtualMachineTasksRecentTime))
	print("")
	print("########")
	print("")