Monitoring VMware vSphere with Zabbix: vCenter Setup, VMware Collectors and Templates

Set up Zabbix VMware monitoring: enable StartVMwareCollectors, create a vCenter host with the VMware or VMware FQDN template, macros and troubleshooting.

Short answer: Zabbix monitors vSphere agentlessly through the vCenter (or ESXi) SDK. First enable VMware collectors on the Zabbix server with StartVMwareCollectors and restart it. Then create one host linked to the VMware or VMware FQDN template and set {$VMWARE.URL} to https://<vcenter>/sdk, plus the username and password macros. Low-level discovery then creates hosts for hypervisors and VMs automatically.

How Zabbix VMware monitoring works

Zabbix needs no agent on ESXi hosts. Dedicated vmware collector processes in the Zabbix server (or proxy) log in to the vSphere Web Services API, cache configuration and performance counters in shared memory, and serve that cache to vmware.* items. According to the Zabbix VMware monitoring manual, the server must be built with --with-libcurl --with-libxml2. Official Zabbix packages already include both.

Step 1: enable VMware collectors on the Zabbix server

By default no collectors run. Edit /etc/zabbix/zabbix_server.conf (or the proxy config if a proxy monitors vCenter):

StartVMwareCollectors=2
# optional tuning, see the zabbix_server.conf reference
# VMwareCacheSize=
# VMwareFrequency=
# VMwarePerfFrequency=
# VMwareTimeout=
systemctl restart zabbix-server

Zabbix recommends running more collectors than monitored VMware services, and no more than twice as many. With too few, slow configuration retrieval on large vCenters delays performance data. VMwareCacheSize holds the shared memory for VMware data, so size it to the number of hosts and VMs you monitor. Use Zabbix internal monitoring to see how full the cache is and how busy the collectors are.

ParameterMeaning
StartVMwareCollectorsNumber of pre-forked VMware collector processes
VMwareCacheSizeShared memory for VMware data
VMwareFrequencySeconds between configuration data gathering from one VMware service
VMwarePerfFrequencySeconds between performance counter retrievals
VMwareTimeoutMaximum wait for a response from the VMware service

Step 2: prepare a vCenter service account

The Zabbix guide uses administrator@vsphere.local as an example. In production, use a dedicated SSO user with the Read-only role, propagated from the vCenter root object. Monitoring only reads inventory, events and counters. Zabbix does not document a minimum privilege set, so if some items stay unsupported, check permissions before anything else.

For datastore capacity metrics, the Zabbix docs require the vCenter advanced setting vpxd.stats.maxQueryMetrics to be at least 64.

Step 3: create the vCenter host and macros in Zabbix

  1. Data collection > Hosts > Create host, for example VMware environment, host group VMware. No interface is needed.
  2. Link the template VMware FQDN or VMware (see below).
  3. On the Macros tab set the three macros, using a secret text type for the password.
{$VMWARE.URL}      = https://vcenter.example.local/sdk
{$VMWARE.USERNAME} = svc-zabbix@vsphere.local
{$VMWARE.PASSWORD} = ********

Discovery rules such as vmware.hv.discovery[{$VMWARE.URL}] then create hypervisor hosts (template VMware Hypervisor) and VM hosts (template VMware Guest) from host prototypes. Check the results in Monitoring > Hosts > Latest data.

VMware vs VMware FQDN template

The template documentation explains that the difference is naming. VMware names discovered VM hosts from vCenter data (UUID-based macros, VM names as shown in vCenter). VMware FQDN uses the guest FQDN. That requires VMware Tools and a unique, FQDN-compliant OS name in each VM. It also avoids duplicate hosts when the same VMs also run a Zabbix agent that auto-registers under its hostname. Do not link VMware Guest manually: it is meant only for discovery.

Troubleshooting Zabbix vCenter monitoring

  • “No vmware collector processes started”: StartVMwareCollectors is 0 on the server or proxy that actually polls the host.
  • Items “Not supported” on datastores: the performance counter is not enabled or collected in vCenter, or maxQueryMetrics is too low.
  • Login errors after certificate or password changes: check the URL ends in /sdk and the service account has not expired. See vCenter password expiration fix.
  • Deep debugging: raise the log level for vmware collectors only (debug level 5), as described in the Zabbix manual.

Further reading

Cisco UCS 4.3(5a) Security Fixes: OpenSSH regreSSHion (CVE-2024-6387), libexpat, and What Came After

Cisco UCS 4.3(5a) security fixes: CSCwk62264, CSCwk62723 (OpenSSH CVE-2024-6387) and CSCwk75392 (libexpat), plus later 4.3 fixes up to 4.3(6j).

Cisco UCS Manager 4.3 release notes: security fixes section

Short answer: Cisco UCS 4.3(5a), released 22 October 2024, lists three security fixes in the current UCS Manager 4.3 release notes. CSCwk62264 covers OpenSSH “regreSSHion” (CVE-2024-6387) on 6400/6500 Fabric Interconnects in UCS Manager mode. CSCwk62723 covers the same CVE in Serial over LAN on B-Series and X-Series. CSCwk75392 covers libexpat CVE-2023-52425 in UCS Manager. Later 4.3 releases add more fixes; 4.3(6j) is the newest.

Cisco UCS 4.3(5a) security fixes

Defect IDAffected componentCVEWhat it is
CSCwk62264UCS 6400 and 6500 Series Fabric Interconnects in UCS Manager modeCVE-2024-6387OpenSSH sshd signal-handler race (a regression of CVE-2006-5051). An unauthenticated remote attacker can trigger it by not authenticating within the login grace time.
CSCwk62723UCS B-Series blade servers and X-Series compute nodes, Serial over LAN (SOL)CVE-2024-6387The same OpenSSH issue in the SOL component used for remote console access
CSCwk75392Cisco UCS ManagerCVE-2023-52425libexpat through 2.5.0: denial of service (resource consumption) when a large token needs many full reparsings

For every entry, Cisco uses the same wording: the affected third-party component “has been upgraded to a version that includes fixes for the vulnerability”. None of the three has a configuration workaround listed. The fix is the upgrade.

What changed since my original post

  • My October 2024 version also listed CSCwb81661 (OpenSSL CVE-2021-4160, CVE-2022-0778, CVE-2022-1292) under 4.3(5a). The current release notes do not list that defect in the 4.3(5a) section. CVE-2022-0778 appears under 4.3(2c) as CSCwh46667.
  • CVE-2024-6387 is also listed under 4.3(4c) as CSCwk62264 for “Cisco UCS Manager”. So the OpenSSH fix arrived in two steps: UCS Manager in 4.3(4c), and the Fabric Interconnect and SOL components in 4.3(5a).

Security fixes after 4.3(5a)

Upgrading to 4.3(5a) alone is no longer enough. These are the later 4.3 security fixes, from the same release notes:

ReleaseDefect IDScope
4.3(5c)CSCwm73573Intel CPU and firmware CVEs on C-Series M7 and X-Series M7 (for example CVE-2024-27457, CVE-2024-23918, CVE-2024-21820)
4.3(5d)noneNo security fixes
4.3(6a)CSCwm82813, CSCwm73565A large set of OpenSSL CVEs in UCS Manager third-party software, and CVE-2024-28047 (Intel UEFI) on M5 servers
4.3(6c)CSCwo49706, CSCwo49702, CSCwo49711Intel CVE-2024-45332 on M5/M6, plus CVE-2025-20103 and CVE-2025-20054 on M7
4.3(6d)CSCwq36167Intel CVE-2025-20067 on M6, and CVE-2025-21096, CVE-2025-20053, CVE-2025-24305, CVE-2025-20613, CVE-2025-21090, CVE-2025-22853 on M7
4.3(6f)CSCwn23026, CSCwm68934UCS Manager’s own vulnerabilities: CVE-2023-20077 (command injection by an authenticated admin) and CVE-2023-20076 (privilege escalation from read-only CLI)
4.3(6b), 4.3(6e), 4.3(6g), 4.3(6h), 4.3(6i)noneNo security fixes

Which Cisco UCS 4.3 release to run now

  • Newest 4.3 release: 4.3(6j), added to the release notes on 24 September 2026. Cisco also publishes UCS Manager 6.0 release notes.
  • Avoid 4.3(4a) to 4.3(4d): Cisco has deprecated them and removed their firmware files, and recommends 4.3(4e) or later. See FN74201 (UCS Manager inaccessible after upgrade with integrated S3260) and FN74209 (vFC interfaces may flap). FN74209 lists 4.3(4e) and 4.3(5a) as fixed releases.
  • Cisco publishes no single “recommended” 4.3 build in the release notes. Pick the newest release that supports your server generations, VIC firmware and ESXi drivers, and follow the upgrade path tables in the release notes. Per the 4.3(6) table, you can upgrade directly from any 4.3(x), 4.2(2) or 4.2(3) release, and from 4.2(1i) or a later 4.2(1) patch.

Upgrade order for a UCS domain

  1. Check the upgrade path table for your current release in the 4.3 release notes.
  2. Upgrade the infrastructure A bundle (UCS Manager, NX-OS on the Fabric Interconnects, IOM and FEX firmware). This carries the UCS Manager and FI fixes such as CSCwk62264 and CSCwk75392.
  3. Upgrade the server bundles (B/C/X) through host firmware packages. The SOL fix (CSCwk62723) and the Intel CPU/BIOS fixes are server-side components. Put each ESXi host into maintenance mode first.
  4. Update the ESXi nenic/nfnic drivers to the versions that match the new VIC firmware.

Sources

Related on vdan.cz

CSCwj01478: UCSX-9508 PSU Shows “Power: Error” in UCS Manager (Fixed in 4.3(4a))

Cisco bug CSCwj01478: UCSX-9508 PSUs show Power: Error and Input Source: Unknown in UCSM. Affected from 4.3(2b), fixed in 4.3(4a), workaround.

Cisco UCS Manager 4.3 release notes: resolved caveats

Short answer: CSCwj01478 is a Cisco UCS Manager bug. A UCSX-9508 chassis with 6454 Fabric Interconnects and 9108 25G IFMs shows its PSUs as “Power: Error” and “Input Source: Unknown” while the PSU LEDs are green. The major faults stay even after the chassis is decommissioned and re-acknowledged. The first affected bundle is 4.3(2b)A, and Cisco’s workaround is to reboot the primary IFM. The bug is fixed in 4.3(4a). Because 4.3(4a) to 4.3(4d) are deprecated, upgrade to 4.3(4e) or later.

CSCwj01478 symptom

According to the UCS Manager 4.3 release notes, the problem appears “during the deployment of Cisco UCSX-9508 chassis equipped with Cisco UCS 6454 FI and Cisco UCS 9108 25G Intelligent Fabric Module (IFM) with Cisco UCS Manager integration”. What you see:

  • In the chassis PSU view in UCS Manager: Power: Error and Input Source: Unknown.
  • On the chassis itself: the PSU LEDs are green and the power supplies work normally.
  • Major PSU faults in UCS Manager do not clear, even after you decommission and re-acknowledge the chassis.

The problem is in how the status is reported, not in the power supplies. Its real cost is operational: a permanent major fault hides real alarms, breaks clean health checks, and can get in the way of automation that waits for a fault-free domain.

Affected and fixed releases

ItemValue (UCS Manager 4.3 release notes)
Defect IDCSCwj01478
First bundle affected4.3(2b)A
Listed as openOpen Caveats for Release 4.3(3a)
Documented workaroundReboot the primary IFM
Resolved in4.3(4a) (Resolved Caveats in Release 4.3(4a))
HardwareUCSX-9508 chassis, UCS 6454 FI, UCS 9108 25G IFM, UCS Manager managed

An earlier version of this post called it a “4.3(4a) bug”. That was wrong. 4.3(4a) is the release that fixes it, and the bug affects 4.3(2b) and later 4.3 releases before 4.3(4a).

Workarounds

  1. Cisco’s workaround: reboot the primary IFM of the affected chassis. Do it in a maintenance window, and first check that the servers in the chassis have working paths through both fabrics.
  2. What worked for me: before the fix, I set the chassis fan policy to Max, which cleared the status for a while. This is not in Cisco’s documentation. Treat it as a temporary lab observation, not a fix.

Fix: which release to upgrade to

The fix is in 4.3(4a), but Cisco has since deprecated 4.3(4a), 4.3(4b), 4.3(4c) and 4.3(4d) and removed their firmware files (see FN74201 and FN74209). Cisco recommends 4.3(4e) or later. The newest 4.3 maintenance release in the release notes is currently 4.3(6j). After the infrastructure upgrade, check the chassis PSU view and the fault list.

Sources

Related on vdan.cz

Forgot the ESXi Root Password? Supported Reset Methods (Host Profile, PowerCLI, AD, Reinstall) vs Unsupported Workarounds

ESXi root password lost? Supported resets via Host Profile, PowerCLI, AD or reinstall with VMFS preserved, and why offline configstore edits are lab-only.

Short answer: Broadcom cannot recover a lost ESXi root password, only replace it. If the host is still connected to vCenter, reset root with a Host Profile, vSphere Configuration Profiles or PowerCLI (esxcli system account set). If it is joined to Active Directory, an “ESX Admins” member can reset it. A standalone host with no other admin access must be reinstalled with VMFS preserved. Editing the configuration store offline is an unsupported lab workaround.

Supported ways to reset the ESXi root password

Broadcom lists the options in KB 393496 (ESXi 7.0 and 8.0). Choose one based on what still has access to the host:

MethodRequirementSupport status
Host ProfileHost connected to vCenter; vSphere Enterprise Plus licenseSupported (KB 323617)
vSphere Configuration ProfilesClusters managed by configuration profiles instead of Host ProfilesSupported (KB 393496)
PowerCLI / esxcli via vCenterHost connected to vCenter; on 8.x shell access for vpxuserSupported (KB 376979)
AD account in “ESX Admins”Host joined to AD; access to a domain controllerSupported (KB 390021)
Reinstall, preserve VMFSStandalone host with no other admin pathSupported (KB 393496)
Offline edit of state.tgz / configstorePhysical access, Linux VM, nested ESXiUnsupported, lab only

Reset root with a Host Profile (host managed by vCenter)

Here is a summary of KB 323617, which also covers ESX 9.x:

  1. In Policies and Profiles > Host Profiles, extract a profile from a healthy host of the same version.
  2. Edit the profile, clear all sections, search for root and set Fixed password configuration with the new password.
  3. Attach the profile to the affected host, edit the host customization, then Remediate. No reboot is required, so you can clear the automatic reboot option.
  4. Check compliance, then delete the temporary profile.

Reset the ESXi root password with PowerCLI

If Host Profiles are not licensed, KB 376979 runs esxcli system account set through vCenter. The host must not be Disconnected or Not Responding. On ESXi 8.x, shell access for the vpxuser account must be enabled, and the KB says the method fails if root is lost and that shell access is disabled.

Connect-VIServer vcenter.example.local
$creds = Get-Credential -UserName "root" -Message "Enter root as username and new password"
$esxiserver = Get-VMHost -Name esx01.example.local
$esxcli = Get-EsxCli -VMHost $esxiserver -V2
$userarg = $esxcli.system.account.set.CreateArgs()
$userarg.id = $creds.UserName
$userarg.password = $creds.GetNetworkCredential().Password
$userarg.passwordconfirmation = $creds.GetNetworkCredential().Password
$esxcli.system.account.set.invoke($userarg)   # returns true on success

Reset via Active Directory (“ESX Admins”)

For an AD-joined host, KB 390021 uses the default admin group. Create an AD group named exactly ESX Admins and add a user to it. Sign in to the VMware Host Client with that account, then edit root under Manage > Security & users > Users. Caveat: from ESXi 8.0 Update 3, Config.HostAgent.plugins.hostsvc.esxAdminsGroupAutoAdd defaults to false (KB 369707, the CVE-2024-37085 hardening). On those hosts, this only works if an AD group was already given admin rights on the host.

Standalone host: reinstall ESXi and keep VMFS

With no vCenter, AD or other admin account, the supported path in KB 393496 is a reinstall. Evacuate or power off the VMs. Reinstall the same ESXi version on the boot device and choose to preserve the VMFS datastore. Then restore the configuration if you have a backup, and re-register the VMs from the datastore. A configuration bundle only helps if you took it earlier. See how to back up and restore ESXi host configuration.

Unsupported: editing the ESXi configuration store offline

Older guides replace the password hash in /etc/shadow inside state.tgz from a Linux live CD. William Lam points out that this no longer works from ESXi 7.0 Update 1 onward, because host configuration moved into an encrypted configuration store. His workaround copies the host’s encrypted state from the boot device. It decrypts that state in a nested ESXi VM, edits the password hash in the configstore SQLite database, re-encrypts it and writes it back.

Treat this as lab only. It is not a Broadcom-documented procedure, and it is not in any Broadcom KB. It modifies the boot device directly, and a mistake can leave the host unbootable. On production hosts use one of the supported methods above, or open a support case.

Prevent the next lockout

  • Store root passwords in a vault and rotate them on a schedule (VCF password management does this for managed hosts).
  • Keep a second local admin, or an AD group, with the Administrator role.
  • Back up host configuration after every change. Useful esxcli commands are in esxcli commands for ESXi 8.0.

Further reading

Critical Security Alert: Update to Fixed Version 8.0 U3d Immediately

CVE-2024-38812 is a CVSS 9.8 vCenter RCE exploited in the wild. Versions before 8.0 U3d and 7.0 U3t are affected: patch steps with software-packages.

Urgent Notice from VMware by Broadcom

Short answer: CVE-2024-38812 (CVSS 9.8, a heap overflow in vCenter’s DCERPC implementation) and CVE-2024-38813 are covered by VMSA-2024-0019. All vCenter versions before 8.0 U3d and 7.0 U3t are affected, the September 2024 patches were incomplete, and Broadcom confirmed exploitation in the wild in November 2024. If you are still below those builds, patch now, and always take the latest build from the advisory’s Response Matrix.

VMware has announced that the security patches released on September 17, 2024, intended to address CVE-2024-38812, did not fully mitigate the vulnerability. As a result, all customers are strongly advised to update to the latest version, 8.0 U3d, immediately. Patches for the 8.0 U2 line are also available to address this issue.

This urgent advisory applies to all vCenter Server users, as the newly identified vulnerabilities pose a significant security risk. Notably, two critical vulnerabilities were reported in vCenter Server, including a heap-overflow vulnerability and a privilege escalation vulnerability. These have been responsibly reported to VMware, which has now provided updates to address them.

Key Vulnerability: Heap-Overflow in vCenter Server (CVE-2024-38812)

Vulnerability Description:

A critical heap-overflow vulnerability was discovered in vCenter Server, specifically in its implementation of the DCERPC protocol. The issue has been assigned CVE-2024-38812 and carries a CVSSv3 base score of 9.8, placing it in the Critical severity range.

Known Attack Vectors:

This vulnerability can be exploited by a malicious actor who has network access to the vCenter Server. By sending a specially crafted network packet, the attacker could trigger the heap-overflow, potentially leading to remote code execution (RCE) on the affected system.

Why You Should Patch Now

This vulnerability could allow attackers to gain control over your vCenter Server environment, putting your infrastructure at risk for unauthorized access, data breaches, or service disruptions. Given the widespread use of vCenter Server for managing virtual environments, this threat is extremely serious, especially for businesses relying on VMware for critical operations.

Patch Availability

The new patches, which can be found in the Response Matrix, have been made available for both the 8.0 U3, 8.0 U2 and 7.0 U3 versions of vCenter Server. Customers should apply the new patches immediately to ensure their systems are protected.

What to Do:

  1. Check your version: Identify if your vCenter Server version is affected.
  2. Apply the patches: Use the Response Matrix provided by VMware to download and install the necessary updates.
  3. Follow VMware’s best practices: Regularly update your systems, review security advisories, and apply patches as soon as they are released to minimize security risks.

Mount VMware-vCenter-Server-Appliance-8.0.3.00400-24322831-patch-FP.iso to VCSA VM. Log in to the appliance shell as a user with super administrative privileges (for example, root) and run the following commands:

# To stage the ISO:
software-packages stage --iso

# To see the staged content:
software-packages list --staged

# To install the staged rpms:
software-packages install --staged

ESXi on ASUS NUC 14 Performance (Scorpion Canyon)

ESXi on ASUS NUC 14 Performance (Scorpion Canyon)

In addition to the ASUS NUC 14 Pro (which I recently reviewed), ASUS has also released the ASUS NUC 14 Performance (formally known as Scorpion Canyon) as part of their Intel 14th Generation (Meteor Lake) lineup. Compared to the ASUS NUC 14 Pro and Pro+, the ASUS NUC 14 Performance offers […]


Broadcom Social Media Advocacy

Updated Dashboard for VMware Community Homelabs…

Updated Dashboard for VMware Community Homelabs…

While working on some data analysis for an internal project, I was looking for a better way to summarize and provide some visualizations of the raw data for better consumption. I also wanted to automate this process, so that I could easily build reports or dashboards regardless of the […]


Broadcom Social Media Advocacy

Quick Tip – Retrieving vSAN File Share Network…

Quick Tip – Retrieving vSAN File Share Network…

When creating a new vSAN File Share, which is powered by vSAN File Services, additional network access controls (no access, allow access from any IP or custom) can be configured. To view the configured network permissions, users must expand each file share to get the relevant information. For […]


Broadcom Social Media Advocacy

How to Back Up and Restore ESXi Host Configuration (vim-cmd and PowerCLI Get/Set-VMHostFirmware)

Back up and restore ESXi host configuration with vim-cmd or PowerCLI Get/Set-VMHostFirmware. Same-build and UUID rules, ports and TPM recovery key caveats.

Short answer: On the ESXi shell run vim-cmd hostsvc/firmware/sync_config and then vim-cmd hostsvc/firmware/backup_config, and download the configBundle-*.tgz from the URL it prints. With PowerCLI use Get-VMHostFirmware -BackupConfiguration. To restore, the host must run the same ESXi build and, by default, keep the same UUID. Put it in maintenance mode and use restore_config or Set-VMHostFirmware -Restore. The host reboots.

Which ESXi backup do you need?

You want to protectUseCovered here
The host’s own settings: standard switches, VMkernel ports, storage adapters, users, services, advanced settingsESXi configuration bundle (backup_config / Get-VMHostFirmware)Yes, this page
Virtual machines and their dataA VM backup product that uses the vSphere data protection APIsNo. The config bundle contains no VMs and no VM inventory.
The ESXi image: base image, vendor add-on, drivers and VIBsThe cluster’s vSphere Lifecycle Manager image. Reinstall the same build (bootable ESXi installer USB), then restore the bundle.Only the “same build” rule
One standard configuration for every host in a clusterHost Profiles, or vSphere Configuration Profiles on vSphere 8 and laterNo. It is complementary to the bundle.
Distributed switch configurationvCenter (export the VDS configuration from vCenter)No. Per KB 313510 the restore brings back standard-switch networking. The VDS comes from vCenter.

What the ESXi configuration backup contains

The bundle holds the host’s configuration: networking (vSwitches, VMkernel ports), storage settings, users, services, advanced settings and similar. According to Broadcom KB 313510 it does not contain:

  • Virtual machine inventory. After a restore you re-register VMs from the datastores.
  • Bootbank contents (the ESXi image and VIBs themselves).

The same KB says the procedure is not supported for Distributed Services Engine (DPU) server configurations or for Auto Deploy-provisioned hosts. VM data and datastores need a real backup product; this covers only the host.

ESX 9: KB 313510 lists no 9.x-specific exceptions, so the same vim-cmd hostsvc/firmware and Get-VMHostFirmware procedure applies. On VCF hosts the restore only brings the host back to its own last state. Reconnecting it to vCenter and the distributed switch is still a vCenter task. Test a restore on one lab host before relying on it in production.

Back up ESXi configuration from the command line (vim-cmd)

Enable SSH or the ESXi Shell, log in as root and first record the two values the restore will depend on:

vmware -vl          # ESXi version and build number
esxcfg-info -u      # host UUID

vim-cmd hostsvc/firmware/sync_config
vim-cmd hostsvc/firmware/backup_config
# Bundle can be downloaded at : http://*/downloads/<id>/configBundle-<host>.tgz

Replace * with the host FQDN or IP and download the file with a browser or wget. The file sits under /scratch/downloads only temporarily, so copy it off the host immediately. Store the build number and UUID next to the bundle.

Back up ESXi configuration with PowerCLI (including via vCenter)

Connect-VIServer vcenter.lab.local      # or connect directly to the host
Get-VMHostFirmware -VMHost esx01.lab.local -BackupConfiguration -DestinationPath C:\Backup\ESXi

# all hosts managed by vCenter
Get-VMHost | Get-VMHostFirmware -BackupConfiguration -DestinationPath C:\Backup\ESXi

PowerCLI downloads the bundle from the host itself, so the machine running it needs network access to each host on TCP 443 and TCP 80, per the KB. A missing port 80 rule is the usual reason this fails when you back up ESXi configuration from vCenter.

Schedule ESXi configuration backups for a whole vCenter

A one-time backup goes stale after the next VMkernel or storage change. This PowerCLI script backs up every connected host through vCenter into a dated folder. It writes the build number and host UUID next to each bundle (the two values a restore depends on) and deletes folders older than the retention period. Run it from Windows Task Scheduler or cron (PowerShell 7) on a management VM that can reach every host on TCP 443 and 80.

# Backup-EsxiConfig.ps1 – requires VMware.PowerCLI (VCF.PowerCLI)
param(
    [string]$VCenter    = 'vcenter.lab.local',
    [string]$Root       = 'D:\Backup\ESXi',
    [int]$RetentionDays = 30
)
Connect-VIServer -Server $VCenter | Out-Null          # use a stored credential, not a password in the script
$target = Join-Path $Root (Get-Date -Format 'yyyy-MM-dd')
New-Item -ItemType Directory -Path $target -Force | Out-Null

foreach ($h in Get-VMHost | Where-Object { $_.ConnectionState -in 'Connected','Maintenance' }) {
    try {
        Get-VMHostFirmware -VMHost $h -BackupConfiguration -DestinationPath $target -ErrorAction Stop | Out-Null
        $esxcli = Get-EsxCli -VMHost $h -V2
        [pscustomobject]@{
            Host    = $h.Name
            Version = $h.Version
            Build   = $h.Build
            Uuid    = $esxcli.system.uuid.get.Invoke()
        } | Export-Csv (Join-Path $target 'hosts.csv') -Append -NoTypeInformation
    } catch {
        Write-Warning "$($h.Name): $($_.Exception.Message)"
    }
}

Get-ChildItem $Root -Directory |
    Where-Object { $_.CreationTime -lt (Get-Date).AddDays(-$RetentionDays) } |
    Remove-Item -Recurse -Force

Disconnect-VIServer -Confirm:$false
  • Run it after every change window, not only nightly. A restore needs a bundle from the same build, so take a fresh backup after each ESXi patch.
  • Bundles of TPM-protected hosts restore only onto the same TPM. Keep the encryption recovery keys (esxcli system settings encryption recovery list) in your password vault next to the bundles.
  • The bundle contains password hashes and host certificates. Store it with the same access controls as other credentials.

Restore rules you cannot skip

RequirementWhy it matters
Same ESXi build as the backupInstall the exact build first (vmware -vl), then restore.
Same host UUIDDefault restore refuses a mismatch; restore_config 1 forces it.
Maintenance modeRequired before the restore.
Reboot before restoreThe KB lists a reboot as part of the workflow.
Automatic reboot after restorePlan the outage.

Restore ESXi configuration with vim-cmd

  1. Rename the file to configBundle.tgz and copy it to a datastore on the host.
  2. Enter maintenance mode: vim-cmd hostsvc/maintenance_mode_enter
  3. Reboot the host.
  4. Move the bundle to /tmp/configBundle.tgz.
  5. Run vim-cmd hostsvc/firmware/restore_config 0 (or 1 to override a UUID mismatch). The host reboots when done.

Restore with PowerCLI Set-VMHostFirmware

Set-VMHost -VMHost esx01.lab.local -State Maintenance
Restart-VMHost -VMHost esx01.lab.local -Confirm:$false
# wait for the host to come back
Set-VMHostFirmware -VMHost esx01.lab.local -Restore -SourcePath C:\Backup\ESXi\configBundle-esx01.lab.local.tgz -HostUser root -HostPassword '<password>'

The old vSphere CLI command vicfg-cfgbackup is still in the KB, but only for vSphere 6.7 and earlier. On 7.x, 8.x and 9.x use vim-cmd or PowerCLI.

TPM and encrypted configuration caveats

Since vSphere 7.0 U2 the ESXi configuration can be sealed to the host’s TPM. Broadcom’s KB states that in that case the force option does not work if the host has been changed. In other words, restore_config 1 will not move a TPM-protected config to replacement hardware. What protects you is the recovery key. Record it on every TPM-equipped host and store it off-host, as described in Manage a Secure ESXi Configuration:

esxcli system settings encryption recovery list

If a recovered host keeps asking for the recovery key at every boot and backup_config fails with “Internal error”, check the boot options. KB 410638 traces this to a missing or malformed bootUUID or recovery-key entry.

For other host-level commands see esxcli commands for ESXi 8.0. If you run the free hypervisor, see Free VMware ESXi 8.

Further reading