Home / Backup / How to backup ESXi hosts with PowerCLI

How to backup ESXi hosts with PowerCLI

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.

Executing PowerCLI script

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.

Filled out script

After you provided all the information, the scripts starts to backup the ESXi hosts and places the files into your desired location.

backup ESXi hosts

The script shows a progress bar while backing up the ESXi host.

After the backup is successful, your screen should look like this:

backup ESXi hosts

You can check your path where you wanted to place your backups if the ESXi host backup bundles appear:

check for files

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

Check Also

virtualhome.blog Logo

Top 5 most read posts of 2019

Since 2020 has already begun, I wanted to do a little recap of the blog …


  1. Is there a way to restore these backups?

    • Hi Steve,

      yes you can restore these backups.
      The ESXi host should be placed into maintenance mode first. After that, you can restore the host configuration with the “Set-VMHostFirmware” cmdlet.
      Here is an example:

      Set-VMHostFirmware -VMHost esxhost.yourdomain.com -Restore -Force -SourcePath C:\temp\configBundle-esxhost.yourdomain.com.tgz
      In addition, here is the reference page of this cmdlet: Set-VMHostFirmware – PowerCLI Reference
      Hope this helps !

      Best Regards


Leave a Reply

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