Skip to content

Instantly share code, notes, and snippets.

@Steffen-MLR
Steffen-MLR / GetHyperVCPU.ps1
Created June 7, 2022 09:49
checkmk localcheck for CPU Utilization including VMs for Hyper-V Hosts
# Get CPU % including Virtual Machines local check
$cpucounter = (Get-Counter -Counter "\Prozessorinformationen(_total)\Privilegierte Auslastung").CounterSamples[0]
$value = $cpucounter.CookedValue.toString().Replace(',','.') -as [double]
$output = "P 'CPU Utilization (with VMs)' All=$value"
Write-Host $output "Total CPU (with VMs):" ([math]::Round($value,2))