At the moment I have a lot of scripts laying around which are either snippets or not publishable. Therefore, I’m going to edit them all in the upcoming blog posts and upload them for the community. Today, I’m going to show you a simple but powerful and easy to use script to backup ESXi hosts configuration. This script is intended to use if you are planning on doing major changes to your ESXi hosts. The command I’m using is “Get-VMHostFirmware”. This command retrieves firmware information for the hosts which you want to back up.
I have put this all together in a simple script which asks you for your vCenter server, credentials and the path where you want to store your backups.
How to backup ESXi hosts with PowerCLI
Simply execute the script and follow the steps to fill in the relevant data like an IP address, the username, your password and your destination path in which you want to save the backup files.
After executing the script you will need to fill out the necessary information to connect to the vCenter Server and therefore to backup th ESXi host configuration.
After you provided all the information, the scripts starts to backup the ESXi hosts and places the files into your desired location.
The script shows a progress bar while backing up the ESXi host.
After the backup is successful, your screen should look like this:
You can check your path where you wanted to place your backups if the ESXi host backup bundles appear:
I hope this is a handy tool for you and helps you with your host backup. Feel free to provide me some feedback!
You can get the script on my github page: https://github.com/falkobanaszak/backup-esxi-host-configuration
In addition, feel free to check my github page in general, as I have some more scripts uploaded there: https://github.com/falkobanaszak