You can use either esxcli or vicfg-hostops to enter/exit maintenance mode.
esxcli
vicfg-hostops
Note that you can use vicfg-hostops --operation info to check whether the host is finished with entering maintenance mode or is still busy.
PowerCLI
After connecting to the host or vCenter server: