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 192.168.1.114
To exit maintenance mode from vMA enter the following.
vicfg-hostops -o exit –server 192.168.1.114
You can also issue shutdown or reboot commands from vMA.
vicfg-hostops -o shutdown –server 192.168.1.114
vicfg-hostops -o reboot –server 192.168.1.114
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
Brian is a Technical Architect for a VMware partner and owner of this website. He is active in the VMware community and is helps lead the Chicago VMUG group. This blog Virtualize Tips was started to document and remember things that I come across while working with tech.
Mail | Web | Twitter | LinkedIn | More Posts (169)




