ESX Virtualization

VMware ESXi, vSphere, VMware Backup, Hyper-V... how-to, videos....

Nakivo Backup and Replication - #1 Backup solution for Virtual, physical, cloud, NAS and SaaS

Menu
  • Certification
      • VCP-DCV vSphere 8
          • vcp2024-125.
        • Close
    • Close
  • VMware
    • Configuration Maximums
    • vSphere
      • vSphere 8.0
      • vSphere 7.0
      • vSphere 6.7
      • vSphere 6.5
      • vSphere 6.0
      • Close
    • VMworld
      • VMware EXPLORE 2024
      • VMware EXPLORE 2023
      • VMware EXPLORE 2022
      • VMworld 2019
      • VMworld 2018
      • VMworld 2017
      • VMworld 2016
      • VMworld 2015
      • VMworld 2014
      • VMworld 2013
      • VMworld 2012
      • VMworld 2011
      • Close
    • Close
  • Microsoft
    • Windows Server 2012
    • Windows Server 2016
    • Windows Server 2019
    • Close
  • Categories
    • Tips – VMware, Microsoft and General IT tips and definitions, What is this?, How this works?
    • Server Virtualization – VMware ESXi, ESXi Free Hypervizor, VMware vSphere Server Virtualization, VMware Cloud and Datacenter Virtualization
    • Backup – Virtualization Backup Solutions, VMware vSphere Backup and ESXi backup solutions.
    • Desktop Virtualization – Desktop Virtualization, VMware Workstation, VMware Fusion, VMware Horizon View, tips and tutorials
    • How To – ESXi Tutorials, IT and virtualization tutorials, VMware ESXi 4.x, ESXi 5.x and VMware vSphere. VMware Workstation and other IT tutorials.
    • Free – Free virtualization utilities, ESXi Free, Monitoring and free backup utilities for ESXi and Hyper-V. Free IT tools.
    • Videos – VMware Virtualization Videos, VMware ESXi Videos, ESXi 4.x, ESXi 5.x tips and videos.
    • Home Lab
    • Reviews – Virtualization Software and reviews, Disaster and backup recovery software reviews. Virtual infrastructure monitoring software review.
    • Close
  • Partners
    • NAKIVO
    • StarWind
    • Zerto
    • Xorux
    • Close
  • This Web
    • News
    • ESXi Lab
    • About
    • Advertise
    • Archives
    • Disclaimer
    • PDFs and Books
    • Close
  • Free
  • Privacy policy

ESXi Maintenance Mode Via CLI How-to And Some More Commands

By Vladan SEGET | Last Updated: October 30, 2018

Shares

A short post to bookmark some CLI commands for putting a VMware ESXi host into a maintenance mode. In my lab, I'm running vCenter in a VM, and this VM runs out of a small local datastore. So I can't simply vMotion this VM elsewhere to do a maintenance and patch using VMware Update Manager (VUM).

When the host where that VM runs, needs to be put into maintenance mode, one needs the CLI. That's why this post. But while here I'll add some more commands which are useful for rebooting, or checking up the VMs that runs on the host etc… which might be useful too.

ESXi maintenance mode is mode when it's possible to install patches and updates or plan for a hardware upgrade such as adding more RAM or more internal hard drives. You might also need to service your host to install new firmware to your storage controller, to your motherboard etc. So the use cases for using a maintenance mode are numerous.

The host is in a state of Entering Maintenance Mode until all running virtual machines are suspended or migrated. When a host is entering maintenance mode, you cannot power on virtual machines on it or migrate virtual machines to it.

Whether you patching standalone ESXi host or if you're using VMware Update manager for patching, in both cases you must put a host into maintenance mode. In case you're using VUM the host is placed into maintenance mode automatically.

If you have VMs running on the host, you must migrate them or shut them down. You cannot leave VM running and put a host into a maintenance mode as the system will wait until all running VMs are shut down or are migrated elsewhere.

How to put a host into maintenance mode?

To enter maintenance mode using the command line interface, use this command:

esxcli system maintenanceMode set –enable true

To exit maintenance mode use this command:

esxcli system maintenanceMode set –enable false

Alternatively, there is another command to enter and to exit maintenance mode:

To enter maintenance mode:

vim-cmd /hostsvc/maintenance_mode_enter

To exit maintenance mode:

vimsh -n -e /hostsvc/maintenance_mode_exit

To check if the host is in maintenance mode:

Use one of these commands:

vim-cmd /hostsvc/hostsummary | grep inMaintenanceMode

OR

vimsh -n -e /hostsvc/hostsummary | grep inMaintenanceMode

How to check if ESXi host is in maintenance mode via the cli

While here, some quick commands how to reboot, halt or shutdown:

reboot -f

halt

shutdown

Through the vMA (vSphere Management Appliance):

From the vMA command prompt, you can also enter maintenance mode.

vicfg-hostops -o enter –server 10.10.5.10

To exit maintenance mode from vMA enter the following.

vicfg-hostops -o exit –server 10.10.5.10

You can also shutdown or reboot ESXi hosts command from vMA.

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

Find out which VMs are running on ESXi host:

esxcli vm process list

Check out also my post on How-to power off unresponsive VM through the CLI.

Links:

ESXi/ESX 4.x and ESXi 5.x shutdown and reboot commands

Wrap Up:

Maintenance mode is a special state where the system assures that no VMs are running so the patching/upgrade of the host is possible. After the host has entered the Maintenance mode, no VMs can be deployed or powered-on on the host.

When no more running virtual machines are on the host, the host’s icon changes to include under maintenance and the host’s Summary panel indicates the new state. Host can exit the maintenance mode automatically after the patching process has finished and rebooted the host only if managed via vSphere Update Manager (VUM). If it is an individual host, no automatic maintenance mode exists.

VMware Update Manager is now part of VMware vCenter Server Appliance (VCSA). Windows-based vCenter needs a separate DB and separate software component. VMware is phasing out the Windows vCenter. The latest news was that the next release of VMware vSphere will be the last release where the Windows vCenter server will be part of the vSphere suite.

More from ESX Virtualization:

  • What is VMware Orchestrated Restart?
  • How To Reset ESXi Root Password via Microsoft AD
  • How to Install latest ESXi VMware Patch – [Guide]
  • How to reset ESXi 6.x root password and under which conditions
  • What is VMware Instant Clone Technology?

Stay tuned through RSS, and social media channels (Twitter, FB, YouTube)

Shares
5/5 - (3 votes)

| Filed Under: Server Virtualization Tagged With: ESXi maintenance mode

About Vladan SEGET

This website is maintained by Vladan SEGET. Vladan is as an Independent consultant, professional blogger, vExpert x16, Veeam Vanguard x9, VCAP-DCA/DCD, ESX Virtualization site has started as a simple bookmarking site, but quickly found a large following of readers and subscribers.

Connect on: Facebook. Feel free to network via Twitter @vladan.

Comments

  1. Rickard Nobel says

    May 14, 2013 at 12:05 am

    If I remember correctly the vicfg-hostops command does not really work well since it (for some reason) does not support DRS and your VMs in a cluster will not be vMotion transferred.

  2. sravana says

    October 11, 2017 at 11:07 pm

    how do we check how long the Host is in maintmode. is there any command or any way to find out

  3. Theron says

    November 7, 2017 at 7:55 pm

    What about cancelling an “Enter Maintenance mode” task? In a large environment that is currently set to show all uses tasks, they scroll off very quickly. This one cannot be found now in the web client. I see task vim.Task:haTask-ha-host-vim.host.ServiceSystem.start-15432485 but that one isn’t immediately obvious that it is an Enter Maint task (probably is).

    But I want to be certain before cancelling it. Is the number show the task id?

  4. terence chang says

    June 8, 2020 at 9:10 am

    The esxcli commands are missing an extra dash before ‘enable’. It should be:
    esxcli system maintenanceMode set –-enable true

    • Vladan SEGET says

      June 9, 2020 at 3:39 pm

      Yeah, I know. It’s my WP messing it up. Originally they were there. Sorry about that.

Private Sponsors

Featured

  • Thinking about HCI? G2, an independent tech solutions peer review platform, has published its Winter 2023 Reports on Hyperconverged Infrastructure (HCI) Solutions.
  • Zerto: One Platform for Disaster Recovery, Backup & Cloud Mobility: Try FREE Hands-On Labs Today!
Click to Become a Sponsor

Most Recent

  • Veeam Backup & Replication v13 Beta: A Game-Changer with Linux
  • What is Veeam Data Cloud Vault and how it can help SMBs
  • Nakivo Backup and Replication – Malware Scan Feature
  • Zerto 10 U7 released with VMware NSX 4.2 Support
  • XorMon NG 1.9.0 Infrastructure Monitoring – now also with Veeam Backup Support
  • Heartbeat vs Node Majority StarWind VSAN Failover Strategy
  • Vulnerability in your VMs – VMware Tools Update
  • FREE version of StarWind VSAN vs Trial of Full version
  • Commvault’s Innovations at RSA Conference 2025 San Francisco
  • VMware ESXi FREE is FREE again!

Get new posts by email:

 

 

 

 

Support us on Ko-Fi

 

 

Buy Me a Coffee at ko-fi.com

Sponsors

Free Trials

  • DC Scope for VMware vSphere – optimization, capacity planning, and cost management. Download FREE Trial Here.
  • Augmented Inline Deduplication, Altaro VM Backup v9 For #VMware and #Hyper-V – Grab your copy now download TRIAL.

VMware Engineer Jobs

VMware Engineer Jobs

YouTube

…

Find us on Facebook

ESX Virtualization

…

Copyright © 2025 ·Dynamik-Gen · Genesis Framework · Log in