Contact Info

Crumbtrail

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

Win32_PerfFormattedData_VmTaskManagerStats powershell 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_PerfFormattedData_VmTaskManagerStats WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Sample Code

$strComputer = "."

$objWMi = get-wmiobject -computername localhost -Namespace root\CIMV2 -Query "Select * from Win32_PerfFormattedData_VmTaskManagerStats_HyperVTaskManagerDetail"

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