How to enable Maintenance mode on ESX host from command line

Posted by on May 11, 2010 in VMware, vSphere | 2 comments

This is something that I’ve been meaning to post for a while now. It’s a simple thing but can save you from having to open up the vSphere client or allow you to use this in a script. The commands listed below will allow you to place a ESX host in and out of Maintenance mode from the command line or Service Console (what ever you like to call it).

To enter maintenance mode run the following command

vimsh -n -e /hostsvc/maintenance_mode_enter

To exit maintenance mode run the following command

vimsh -n -e /hostsvc/maintenance_mode_exit

So your probably wondering how do I know if the host is in Maintenance Mode, here you go:

vimsh -n -e /hostsvc/runtimeinfo | grep inMaintenanceMode | awk ‘{print $3}’

Update: March 1st 2011

I thought an update to cover the commands you can run from vMA to enter maintenance mode from vCLI. From the vMA command prompt you can enter the following command to enter maintenance mode.

vicfg-hostops -o enter –server

To exit maintenance mode from vMA enter the following.

vicfg-hostops -o exit –server

You can also issue shutdown or reboot commands from vMA.

vicfg-hostops -o shutdown –server
vicfg-hostops -o reboot –server

Also note that after entering any of the above commands from the vMA it will make you provide Username and Password for the Host that you are working on. Unless you choose to use Fast Pass or Passthrough authentication.

About Brian Suhr

Brian is a VCDX5-DCV and a Sr. Tech Marketing Engineer at Nutanix and owner of this website. He is active in the VMware community and helps lead the Chicago VMUG group. Specializing in VDI and Cloud project designs. Awarded VMware vExpert status 6 years for 2016 - 2011. VCP3, VCP5, VCP5-Iaas, VCP-Cloud, VCAP-DTD, VCAP5-DCD, VCAP5-DCA, VCA-DT, VCP5-DT, Cisco UCS Design


  1. Without grep:
    vimsh -n -e /hostsvc/runtimeinfo 2>/dev/null | awk '/inMaintenanceMode/ { print $NF } '

  2. Without grep:
    vimsh -n -e /hostsvc/runtimeinfo 2>/dev/null | awk '/inMaintenanceMode/ { print $NF } '


  1. Some ESXi CLI Commands - [...] shutdown -r now… it was not so much.Resources:I adapted the maintenance mode commands from here: as: esxi, VCAP, …

Leave a Comment

Your email address will not be published. Required fields are marked *