banshee/virtualization-collection/virtualization/hyperv/winrm/
host
The Hyper-V service, the virtual machines running and the memory of a Hyper-V host, by WinRM and PowerShell.
par banshee1 installation2 versions
v2Dernière
Publiée le 28 octobre 2026. One naming convention across collections; documentation completed.
Hyper-V host, by WinRM
Returns the state of the Hyper-V service of a Windows Server, the number of virtual machines it runs, and the memory left to the host. Three watches are offered, each one set on the probe.
Versions
Windows Server 2012 to 2025 with the Hyper-V role: the WMI class read, Msvm_ComputerSystem of the namespace root\virtualization\v2, comes with Server 2012, as Microsoft documents it. Generic: no folder of version.
How it works
The collector runs one PowerShell script, by WinRM:
$ErrorActionPreference = 'Stop'; [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding; $os = Get-CimInstance Win32_OperatingSystem; $status = @{service = [string](Get-Service vmms).Status; total = $os.TotalVisibleMemorySize; free = $os.FreePhysicalMemory}; if ($status.service -eq 'Running') { $status.running = @(Get-CimInstance -Namespace root\virtualization\v2 -ClassName Msvm_ComputerSystem | Where-Object { $_.Name -match '^[0-9A-Fa-f]{8}-' -and $_.EnabledState -eq 2 }).Count }; ConvertTo-Json -Compress -InputObject $status {"service": "Running", "total": 268032412, "free": 61347820, "running": 14} - The Hyper-V service is
vmms, the Hyper-V Virtual Machine Management service. Its state is returned in lower case:running,stopped,startpending,stoppending. - A virtual machine is an
Msvm_ComputerSystemwhoseNameis a GUID: Microsoft documents it so, and the host itself is in the class under its own name. It runs when itsEnabledStateis 2 (Enabled, "the element is running"). - The machines running are counted only when the service runs: a service that does not run returns its state and the memory of the host.
- The available memory is
FreePhysicalMemory, the memory Windows can give at once. The used memory is the rest, overTotalVisibleMemorySize, as Task Manager shows it. - With
$ErrorActionPreferenceset toStop, any failure ends the script with no answer. The collector then stopsmisconfiguredwith the error PowerShell gave: Hyper-V not installed (no servicevmms), or the account refused by Hyper-V. It never answers zero machines in that case.
Nothing is written to the Windows: the script only reads.
Prerequisites
- WinRM in HTTPS on the Hyper-V host (port 5986, or
protocol:winrm:port), with the firewall open to the poller and NTLM accepted. Its certificate is judged by the TLS profile of the probe: an authority the poller knows, one underprotocol:tls:authorities, a fingerprint pinned inprotocol:winrm:fingerprint, or the first one trusted in the tab "Security". The documentation of the collectorswindows/winrm/…ofbanshee/windows-collectiongives each command. - Windows PowerShell 3.0 or later. The PowerShell module of Hyper-V is not needed: the script reads the WMI classes of Hyper-V.
- An account for monitoring, local or of the domain, in
protocol:winrm:userandprotocol:winrm:password, member of two local groups: - "Remote Management Users", which opens WinRM to it; - "Hyper-V Administrators", which opens Hyper-V to it. - What "Hyper-V Administrators" allows: in Microsoft's words, "complete and unrestricted access to all the features in Hyper-V". The account may create, start, stop, change and delete the machines.
- Why there is nothing narrower: Hyper-V has no read-only role. For managing a Hyper-V host remotely, Microsoft documents two groups only, the local Administrators and Hyper-V Administrators, and the second is the narrower of the two. A permission limited to the WMI namespace
root\virtualization\v2is not documented by Microsoft as enough, and is not verified. - The barrier: the script only reads, and its diff is read on the poller before it runs.
Outputs
| Name | Label | Unit | Per instance |
|---|---|---|---|
service | Hyper-V service | — | no |
running | Virtual machines running | — | no |
memory-available | Available memory | MiB | no |
memory-used-percent | Used memory | % | no |
Watches
| Name | Title | Kind | Defaults | Checked by default |
|---|---|---|---|---|
service | Hyper-V service not running | expected value, on service | critical when the state is anything but running | yes |
memory-high | Memory saturated | above a threshold, on memory-used-percent | warning above 90 %, critical above 95 %, for 3 runs | yes |
available | Little memory available | below a threshold, on memory-available | critical below 2048 MiB: a machine may no longer start | no |
Limits
- The memory of the host is read as
windows/winrm/memoryofbanshee/windows-collectionreads it: a probe of each on one host watches it twice. - Not checked on a real Hyper-V: the class, its properties and its codes are those of Microsoft's documentation of the Hyper-V WMI provider (
Msvm_ComputerSystem), and the servicevmmsis the one Microsoft's Hyper-V documentation names. Running the script against a host is not done.