Forum Discussion
pabloh11
Mar 09, 2026Copper Contributor
PS script for moving clustered VMs to another node
Windows Server 2022, Hyper-V, Failover cluster We have a Hyper-V cluster where the hosts reboot once a month. If the host being rebooted has any number of VMs running on it the reboot can take hours...
Jamony
Jul 15, 2026MCT
You don't need to enumerate the VMs yourself. Failover Clustering can drain the node and live-migrate its clustered roles before the reboot:
Import-Module FailoverClusters
Suspend-ClusterNode -Name "HV01" -Drain -Wait
If everything must go to one host, add -TargetNode "HV02"; otherwise the cluster selects suitable owners. Before rebooting, confirm this returns no VM groups:
Get-ClusterGroup | Where-Object { $_.OwnerNode -eq "HV01" -and $_.GroupType -eq "VirtualMachine" }
After the server returns, run:
Resume-ClusterNode -Name "HV01" -Failback NoFailback
Use Immediate instead of NoFailback only if you intentionally want workloads moved back. Also verify the remaining nodes have enough CPU and memory capacity before draining.