How to use powershell to administer Hyper-v Cluser

If you want to address the entire cluster from PowerShell, the best solution is probably the PowerShell module in System Center Virtual Machine Manager. It was built for this.

The PowerShell module that you’re using was intended for single-host scripting. It can still be made to work. You can restructure your code above. As an example:

$clusterNodeNames = (Get-ClusterNode -Cluster ClusterName).Name
$AllVMsInCluster = Get-VM -ComputerName $clusterNodeNames
$AllVMsInCluster | Save-VM -Confirm:$false

Leave a Comment