How to Remove a VMware ESXi Host From vCenter Server | Command Line

If you are familiar with the command, why not try using the command remove ESXi host from vCenter. It will only take a few minutes and you will complete all the operations.

Crystal

By Crystal / Updated on October 31, 2023

Share this: instagram reddit
 
   
   

  Case: How can I remove my ESXi host from vCenter server?

Hi All,

How do I disconnect esxi hosts from the vCenter that is no longer in use? So I have a couple ESXi hosts that were previously connected to a vcenter. Some unfortunate incidents happened and we lost the machine that hosted the vcenter service alongside with the ip that it used to bind with.

Now I set up a new vCenter on a new machine, and am trying to add those esxi hosts to this new vcenter. I tried everything online, but didn’t work. Please help.

- Question from Reddit

Remove a Host from vCenter Server

Removing a managed ESXi host from vCenter Server stops vCenter Server from monitoring and managing that host. We have discussed how to remove a host from vCenter inventory with Web GUI. Today, I will guide you the simple steps on how to remove ESXi host from vCenter Server using command lines.

In order to remove a ESXi host from vCenter Server successfully, you should note these prerequisites.

  • Make sure that NFS mounts are active. If NFS mounts are unresponsive, the operation fails.
  • If the host you want to remove from the cluster is connected to a distributed switch, remove the host from the switch.

✍If possible, remove managed hosts while they are connected. Removing a disconnected host does not remove the vCenter Server agent from the managed host.

How to Remove a Host from vCenter Server Using Command Line

Here, you will use the Remove-VMHost cmdlet to remove a ESXi host from your vCenter Server inventory. The Remove-VMHost cmdlet has the following syntax:

Remove-VMHost [-VMHost] [-Server] [-WhatIf] [-Confirm]

Next, let's go to remove a host as seen in the following screenshot:

remove esxi host from vcenter cmdlet

You could note that “The operation failed”, because the host has not been placed in maintenance mode or a disconnected state before you could remove it.

remove host failed

So let's put the host in maintenance mode first and then try to remove it:

PowerCLI C:\> $VMHost = Get-VMHost –Name 192.168.0.133
PowerCLI C:\> $VMHost | Set-VMHost -State Maintenance

Name                                   ConnectionState PowerState NumCpu CpuUsageMhz
----                                         ----------------------  --------------- ------------  -------------------
192.168.0.133                    Maintenance        PoweredOn              2                          41

PowerCLI C:\> $VMHost | Remove-VMHost -Confirm:$false

The preceding command sets the host in maintenance mode and will remove it from the vCenter Server inventory and cluster.

The vCenter Server will not manage and monitor the removed the host and associated virtual machines once you remove them from the vCenter Server instance.

✍ Removing ESXi host is risky in terms of data loss, and there are more potential threats in a virtual environment than that, and backups are a common and necessary means to ensure data security.

Data Insurance: Virtual Machine Backups

vCenter Server is a very convenient official platform for centrally managing ESXi virtual environments and large numbers of VMs on it. Although VMware provide an official feature to backup vCenter configurations, but it does not provide the feature of virtual machine backup.

The AOMEI Cyber Backup is a reliable VMware backup software which delivers complete data protection for vCenter-managed and standalone ESXi workloads.

 AOMEI Cyber Backup enables you to backup multiple VMs in 3 simple steps and offers you the following benefits.

Backup in batch: Backup large numbers of VMs managed by vCenter Server or standalone ESXi host at once.
Hot backup: Simply backup VMware VMs while running. No need to suspend operations and ongoing access.
Automation: Create VMware backup schedule to automate VM protection, and enable retention policy to auto delete old backup files.
Restore to new location: Besides in-place recovery, you can restore a VM to new location in the same or another datastore/host/vCenter for migration or cloning.
Flexible backup method: Besides full backup, it offers incremental/differential mode to auto track changed data.
Email notification: Send email notification when the task is completed or abnormal.

You can click the following button to download the software.

Download Free TrialVMware ESXi & Hyper-V
Secure Download

*You can choose to install this VM backup software on either Windows or Linux system.

Backup multiple virtual machines with AOMEI Cyber Backup

Next, I will show you how to backup VMs managed by vCenter Server with AOMEI Cyber Backup in 3 simple steps

1. Navigate to Source Device > VMware > + Add VMware Device to add vCenter or Standalone ESXi host. And then click  > Bind Device.

bind device

2. Create backup task by hitting Backup Task > Create New Task. Follow the Wizard to schedule VM backup.

  • You can select as many VMs as you need to back them up at once.
  • Schedule daily/weekly/monthly VMware backup with different backup strategies, such as full backup for the entire VM and incremental backup for the changed data.
  • Set up backup cleanup to auto delete the old backup copies that exceed the retention period you specified.

3. Click Start Backup. You can select Add the schedule only or Add the schedule and start backup now.

start backup

Created backup tasks will be listed and monitored separately, for restoring, progress checking and schedule changing. When restoring, you can also restore to new location to create a new VM in the same or another datastore/host/vCenter directly from the backup, saving the trouble of re-configuring the new VM.

restore vm

AOMEI Cyber Backup ensures that your VMs are recoverable within minutes in any data loss scenario.

Summary

You can shrink the capacity of your VMware vCenter Server instances by removing VMware ESXi hosts as your business needs dictate. This article guides you to remove ESXi host from vCenter Server using simple command lines. During this process, please note that the host should be placed in maintenance mode first, otherwise there will be an operation error.

Crystal
Crystal · Editor
Crystal is an editor from AOMEI Technology. She mainly writes articles about virtual machine. She is a positive young lady likes to share articles with peolpe. Off work she loves travelling and cooking which is wonderful for life.