Using PowerCLI to Backup and Restore ESXi Host Configuration

by admin

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.

Keep up to date with new posts on Buildvirtual.net - Follow us on Twitter:
Be Sociable, Share!

Leave a Comment

*

Previous post:

Next post: