ESXi How to backup restore the host configuration with powercli

ESXi How to backup restore the host configuration with powercli

    Why powercli?
    A lot of what I’ve seen out there for backing up the host configuration uses VMA or Vcli but I use powercli more consistently as I know a lot of other people do also.

    Here is the code to backup your esxi host via powercli

    Get-VMHostFirmware -VMHost $host -BackupConfiguration -DestinationPath C:DownloadFolder
    Set-VMHostFirmware -VMHost $Host -Restore -SourcePath c:bundleToRestore.tgz -HostUser user -HostPassword pass

    *note: that the backup config files can be restored only to the same version of esxi and same build.
    I havent tested otherwise but posts on different blogs confirm that.

    Pre-backup evidence
    Test host: before backing up
    Here are some configs that I want to see go over after restoring

    Backing up the config
    Connect to your host/vcenter first

    Get-VMHostFirmware -VMHost $host -BackupConfiguration -DestinationPath C:Downloads

    Here is what is backed up, its tiny!

    Installing ESXi

    Here is the new install booting from dhcp

    Restoring Using:
    Set-VMHost -VMHost Host -State ‘Maintenance’

    Set-VMHostFirmware -VMHost Host -Restore -SourcePath c:bundleToRestore.tgz -HostUser user -HostPassword pass

    Connected to esxi host
    Place into maintenance mode

    I had to use the force optionotherwise I was getting  Restore failed: fault.MismatchedBundle.summary

    Server came up by itself:
    Here is the console

    Here are the settings in the vmware client

    Looks like I will have to add the nic manually to the switch labeled vswitch1

    It knows the NTP time setting

    It can be a great timesaver if you have a lot of settings to redo.

    *Note was readig that  this cant be used to restore the config to a different system because you will get a fault.MismatchedBundle.summary because the nic macs are different
    I havent tried that with the force option so it might work…..


Leave a Reply

Your email address will not be published. Required fields are marked *