If you are using the service console and want to put the ESX server into maintenance mode, simple run the following commands:

Enter maintenance mode:

vimsh -n -e /hostsvc/maintenance_mode_enter

Exit maintenance mode:

vimsh -n -e /hostsvc/maintenance_mode_exit

How do you check whether you are in maintenance mode or not?

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