Post Source : vmkdaily
There are many ways to place an ESXi host into Maintenance Mode. We can use PowerCLI, vCLI, SSH, DCUI, etc. In this case I will be showing how to do this via SSH. I will demonstrate the use of the vim-cmd and esxcli commands to check if a host is in Maintenance Mode, and if not, place the host into Maintenance Mode.
That was then
This example uses the familiar vim-cmd command on ESXi 5.x:
This is now
Next, we see the new way VMware wants us to do this using esxcli (again on 5.x):
That’s it. Pretty simple and it’s a good practice to do this before rebooting an ESXi host from the command line. Honestly, reboots of ESXi hosts should be done from the GUI, but if you were troubleshooting an issue and decided to reboot the host from the command line, performing the above ensures that no VMs are running.