I am looking for a way to automate nightly backups of my VMWare ESXi Configs for disaster recovery.
Ideally the script would connect to my vCenter server, poll it for hosts, and then backup the config in a logical directory structure, including the current ESXi version running, since config backups can only be restored to a machine running the exact same build.
Is there such a script available somewhere?
There sure is. Here is an example, using Power-CLI:
This script first disables the error message when certificate errors happen, and then in goes through all of the hosts on a particular vCenter and backs up their config to a directory structure of "\ServerName\ESXiVersion\BuildNumber"
This makes rebuilding a particular host very easy...
esxcli software profile update
command and point it to the proper download location for the build number you need. A list of the correct locations was found at https://tinkertry.com/easy-update-to-latest-esxi at the time of this post.Set-VMHostFirmware -VMHost ESXi_host_IP_address -Restore -SourcePath <Backup Location>