Posted in
Windows Powershell,
Windows Server |
No Comment | 3,059 views | 09/07/2013 17:37
This will give you host and guest CPU usage on your Hyper-V host.
1
2
3
4
5
6
7
| $ClusterNode = "Host01"
While ($True)
{
$ChildCPU = ((Get-Counter -ComputerName $ClusterNode -Counter "\Hyper-V Hypervisor Logical Processor(_Total)\% Total Run Time" -MaxSamples 3).CounterSamples | Measure-Object CookedValue -Max).Maximum
$ParentCPU = ((Get-Counter -ComputerName $ClusterNode -Counter "\Processor Information(_Total)\% Processor Time" -MaxSamples 3).CounterSamples | Measure-Object CookedValue -Max).Maximum
Start-Sleep 5
} |
$ClusterNode = "Host01"
While ($True)
{
$ChildCPU = ((Get-Counter -ComputerName $ClusterNode -Counter "\Hyper-V Hypervisor Logical Processor(_Total)\% Total Run Time" -MaxSamples 3).CounterSamples | Measure-Object CookedValue -Max).Maximum
$ParentCPU = ((Get-Counter -ComputerName $ClusterNode -Counter "\Processor Information(_Total)\% Processor Time" -MaxSamples 3).CounterSamples | Measure-Object CookedValue -Max).Maximum
Start-Sleep 5
}
You should change $ClusterNode to start monitoring.