← script library

Hyper-V VM Status Checker Script

Hyper-VJanuary 10, 2025

This PowerShell script checks the status of your Hyper-V virtual machines. It helps in monitoring whether your VMs are running, turned off, or in an error state.

powershell
Import-Module Hyper-V

$vms = Get-VM | Select-Object Name, State

foreach ($vm in $vms) {
    Write-Host "$($vm.Name) is currently $($vm.State)"
}

$vms | Export-Csv -Path "C:\HyperV_VM_Status.csv" -NoTypeInformation

Run it across your fleet

This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.

Ready when you are.

Try ServerEngine free for 7 days.