Backup ESXi Configuration
To backup the ESXi configuration we can do this via the esxi shell.
First we need to Sync the config by running this
vim-cmd hostsvc/firmware/sync_config
To back-up the configuration data run this command
vim-cmd hostsvc/firmware/backup_config
This command will output a URL which can then be downloaded by a remote client.
You can use curl, wget, or even a browser to download the file.
To Restore the Configuration on a new ESXi Hypervisor
First rename the configuration file to
configBundle.tgz
Now Put the host into maintenance mode by running this command
vim-cmd hostsvc/maintenance_mode_enter
Copy the backup configuration file to the ESXi host or an available datastore (or mount a NFS volume and put it there)
Run this command to restore the ESXi hosts configuration (replace backup_location with the location you put the file)
vim-cmd hostsvc/firmware/restore_config /backup_location/configBundle.tgz
If you receive a UUID mismatch, then you can override this by adding a 1 (digit 1) after restore_config, but this will ONLY work if you are not using TPMS.
vim-cmd hostsvc/firmware/restore_config 1 /tmp/configBundle.tgz
Executing this command will initiate an automatic reboot of the host after command completion.