Using PowerCLI to Backup and Restore ESXi Host Configuration

As an alternative to vicfg-cfgbackup.pl as a way to backup and restore ESXi host configuration you may want to consider PowerCLI.

As a quick review, vicfg-cfgbackup is a script that allows you to backup and restore your host configuration. To use it you will need to install vCLI (on windows or linux) or you can use the vMA Appliance.

The basic syntax is as follows:

You can use vicfg-cfgbackup.pl –server server_name -f -l backup_file_name to create a configuration backup, whilst vicfg-cfgbackup.pl –server server_name -r can be used to restore.

Anyway, back to PowerCLI. Using the Get-VMHostFirmware CMDlet we can also backup and restore our configuration.

To create a backup:
Get-VMHostFirmware -VMHost $host -BackupConfiguration -DestinationPath C:\HostBackups

And to restore a configuration:
Set-VMHostFirmware -VMHost $Host -Restore -SourcePath c:\Hostbackups\backupfile.tgz -HostUser user -HostPassword password
You can read more about it here

One thing to look out for, like when using vicfg-cfgbackup.pl, is that if you are restoring the configuration to different hardware you will need to use the -force parameter.

Related posts

VMware vSphere Virtual Machine Snapshots Explained

How to Enable SSH on All ESXi Hosts using PowerCLI

How to Install VMware Tools on Debian 11

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More