How to place VMWare vSphere ESXi Host into maintenance mode via esxcli

Recently, I was attempting to place a ESXi host into maintenance mode via the GUI in vCenter. However, it kept failing even after i restarted services and rebooted the vCenter. This forced me to break out some old commands to perform this task via CLI on the ESXi host itself.

Confirm the host is not in maintenance mode already:
#localcli vsan cluster get

Screenshot from the Place an ESXi Host in Maintenance Mode With esxcli walkthrough at step 1, showing Maintenance Mode State; the adjacent article text explains that confirm the host is not in maintenance mode already:#localcli vsan cluster get.

Place the host into maintenance mode:
#esxcli system maintenanceMode set –enable true -m ensureObjectAccessibility

**I put ensure object accessibility because I don’t want data moving around

Screenshot from the Place an ESXi Host in Maintenance Mode With esxcli walkthrough at step 2, showing Maintenance Mode State: ON; the adjacent article text explains that confirm host is in maintenance mode by running the 1st command again.
Confirm host is in maintenance mode by running the 1st command again

When the time comes to take host out of maintenance mode:
#esxcli system maintenanceMode set –enable false

Screenshot from the Place an ESXi Host in Maintenance Mode With esxcli walkthrough at step 3, showing Maintenance Mode Stati; the adjacent article text explains that when the time comes to take host out of maintenance mode:#esxcli system maintenanceMode set -enable false.
confirm host is out of maintenance mode by running the 1st command

Summary:
Three simple commands to bypass the GUI & place a host into maintenance mode. For your experience VMWare engineer I know this isn’t anything new but you never know when you need to refresher. As always, I hope y’all found this useful.

Keep exploring

Choose your next step

Continue with the path that best matches the architecture or operating challenge in front of you.

Leave a Reply

Discover more from Digital Thought Disruption

Subscribe now to keep reading and get access to the full archive.

Continue reading