Contact Info

Crumbtrail

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

Win32_PerfRawData_VmTaskManagerStats perl 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

use Win32::OLE('in');

my $computer = ".";

my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n";
my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_PerfRawData_VmTaskManagerStats_HyperVTaskManagerDetail", "WQL");

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