How to Backup the ESXi Configuration
First of all, since this tutorial will be using the ESXi command line, you will need to connect to the host using SSH. If you don’t know how to enable SSH, you can learn how in the following post: How to Connect to an ESXi 6.5 Host using SSH on Windows.
Once you have connected to the host via SSH, run the following command to backup the configuration:
The following image shows the output of the command.
The backup will be saved in /scratch/downloads
Obviously storing the backup on the same device is not ideal so we need to transfer the archive off the host. You can do that by entering the URL of the backup commands output into a web browser. As you can see in the image above the URL does not contain the IP address of the host. You will need to replace the * with the host IP address.
Alternatively you can use WinSCP or some other utility to transfer the archive using SSH. To learn how to transfer files you can read: How to Transfer ISO Images and Files to an ESXi Host from Windows.
Restoring the ESXi Configuration
In order to restore the backup of the ESXi configuration, you need to install the same version and build number of ESXi on your hardware. Once installed, you need to configure the management network so that you can connect to the device using SSH. Again you will need to enable SSH which you can find out how to do in the post: How to Connect to an ESXi 6.5 Host using SSH on Windows.
Once connected you will need to transfer the backup archive to /tmp/configBundle.tgz on the host using a transfer utility. Read How to Transfer ISO Images and Files to an ESXi Host from Windows to find out how.
With the file transfered, all that’s left to do is run the following commands:
vim-cmd hostsvc/maintenance_mode_enter vim-cmd hostsvc/firmware/restore_config /tmp/configBundle.tgz
The host will reboot with the old configuration applied. You can now exit maintenance mode and use the host.