Reboot ALL ESXi hosts in a cluster at one time
Do you:
- hate your job?
- dislike your users?
- like getting headaches at 3:45pm on a Friday?
- love creating RCAs for your leadership?
Well you’re in luck, you crazy and reckless soul!
If you want to reboot all your ESXi hosts at once, I have the PowerCLI that will make that happen!
But seriously- if you’re building out a brand new cluster of hosts, you might have them all in Maintenance Mode and want to reboot them all simultaneously, to, say do a one-liner ESXi update (if you don’t have Update Manager) or if you need to manage TLS settings on your hosts.
Connect to your vCenter (Connect-ViServer YourVCenterName) and proceed with caution.
Here we go:
get-cluster -Name "YourCluster" | Get-VMHost | Restart-VMHost -Confirm:$false
If you do it this way, you’ll see the tasks in vCenter but no confirmation in PowerCLI. You will see a status output, which is weird, but OK.
If you want to do all your hosts on the vCenter, use this (with great caution making sure all hosts are in Maintenance Mode):
Get-VMHost | Restart-VMHost -Confirm:$false
If you want to confirm what hosts are affected, switch out -Confirm:$False for -WhatIf
If you don’t use -Confirm:$False or -WhatIf, you will be asked to confirm each reboot, which isn’t that bad unless you have 100 of them.