ESXi 5.0 / ESXi 5.1 Host Backup & Restore GUI Utility (PowerCLI based)


This is a little bit of  a fun project I have been working on in bits of spare time I find. It is all written in PowerCLI 5.0 / 5.1 / PowerShell and the GUI was laid out using Primal Forms Community Edition.


Updates (17-02-2013) – version 1.3:

  • Hosts are retrieved using a new method (for both backup and restore options)

Updates (29-12-2012) – version 1.2:

  • Added ESX/ESXi host validation into utility – will now test that the host is valid and either connected or in maintenance mode before attempting backup or restore (See the script’s new “Check-VMHost” function for those interested)
  • Minor UI improvements

Updates (29-10-2012) – version 1.1:

  • This utility has been tested on ESXi 5.1 Hosts and confirmed to be able to successfully create a backup archive file of these.
  • Be sure your DNS is working correctly on the system you run the Backup utility on – it relies on DNS to find your ESXi hosts as they are named in the dropdown when you select the host to backup. (See comments for troubleshooting)
  • Restore to new hardware (force restore) option added
  • Fixed labels and connection box label description


What it is essentially, is a GUI that allows you to Backup ESXi 5.0 or ESXi 5.1 hosts to a destination of your choice on a local drive. It also allows you to restore ESXi Host configuration bundle backups taken, to other Hosts. I had other plans to integrate cloud storage options in (Amazon S3) as a backup target, but I thought that this doesn’t really offer anything valuable and I would just keep it relatively simple for now – therefore I have disabled this functionality. The PowerCLI script is fairly long – and I know there are plenty improvements I could make to better it and shorten the code, but for now it does the job. I have added various catches for exceptions / errors so you should get visual feedback if you have entered an invalid path, or username for example.


Anyway, hopefully this proves useful to some! As always, take care using the backup / restore functionality of this utility. The restore functionality works by first putting the ESXi host into Maintenance mode (if it isn’t already in this mode) and then applying a backup bundle to the host (Restore). The Host will reboot immediately following this. The Backup and Restore is implemented using Get-VMHostFirmware and Set-VMHostFirmware cmdlets so you can read the help descriptions for an idea on how exactly these work. The Host Backup Bundles are stored in a path of your choice and when restoring from a path the cmdlet works by looking for a bundle filename that matches the name of your ESXi host selected to restore to. Note that the file browser module I have implemented here (used to select paths) is a modification of the work done by Ravikanth Chaganti on his PowerShell Help Browser GUI. I simply adapted his code to list the contents of local drives in a tree view instead of PowerShell Help cmdlets. The only limitation here is that I have not implemented code to browse further than one level into the root of each drive. If you can provide this modification yourself, please feel free to contribute in the comments! I have just not spent the extra time to do this myself yet.


Here are a couple of quick screenshots of the Utility / GUI:



ESXi 5.0 Host Backup & Restore GUI Utility & Path Browser


Current version (1.3):

(Version 1.3) [download id=”25″]


Previous versions:

(Version 1.2) [download id=”21″]

(Version 1.1) [download id=”20″]

(Version 1.0) [download id=”9″]





  1. @Theodor Machnich

    Hi Theo,

    Yes, it should work fine with ESXi 5.5. Which license do you have for vCenter? You’ll need “Enterprise Plus” licensing in order to use vSphere Host Profiles, which will make your life a lot easier. This tool I made is mainly used for single ESXi hosts that are not managed by vCenter, and for cases where you do not have the host profiles feature available to use.

    You can use this tool I made to backup a host configuration, and restore it to another host (or the same host) as long as the hardware does not change. If it does change, you can run into issues like a network configuration applying to a different network card etc…

    Going back to host profiles – that way will be easiest for you – but of course it relies on you having Enterprise plus licensing and that your host is in a cluster in vCenter. You can then read up on host profiles here: //


  2. Dear Sean,

    thank you for your replay, thats great.
    The last 3 days I was engaged and spend and wast my lifetime to clone my ESXi to a bigger SSD, but this works not really.
    Cloning and to boot the new SSD works perfekt, but I was not able to asume the new diskspace to the ESXi itself.
    So I found no solution to expand the free diskspace, think this can only work in a case to have a program like gparted which can handle vfms5 partition and filesystem.
    To find such a sollution will do the work to move a instalation to new disk verry easy.
    So when I hav much more fun, I will try your way….all the best Theo

  3. This may sound like a dumb question, but when trying a restore, do we just provide the host with a valid ip address and the script will take care of the rest in terms of network config, domain authentication etc?

  4. The process would be – take a backup of the host, then use the restore option after selecting the same host in the drop down for the restore section. Provided the hardware of the actual ESXi host is identical and hasn’t changed, it’ll restore the configuration file that you originally backed up back onto the host, and everything in terms of config should go back to what it was.

    Of course, this relies on the fact that you have the host up and running and the management interface is working with a valid network configuration for the utility to connect to the host on 🙂

    As I always say, I would test the process on a test environment first to ensure you are happy with the way it works first.

    The whole idea behind the host not changing hardware layout at all is because if you were to for example install a new physical NIC in your host, the IDs of hardware could shift around, and the old backup config file could reference a broadcom network card for ID 0 and an Intel for ID1 – the broadcom could be used for vMotion, and the Intel for Management and therefore the config restore would be wrong. That’s why I only recommend this is used if your host doesn’t change at all in terms of hardware layout between the backup and the restore 🙂


  5. This may help someone else. I was getting “Exception caught: The argument is null or empty.” and the script would terminate. I removed the following block of code:


    Try {
    [void] [System.Reflection.Assembly]::LoadWithPartialName(“System.Drawing”)
    [void] [System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”)

    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Text = “vCenter IP or DNS Name”
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = “CenterScreen”

    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq “Enter”)
    $objForm.Add_KeyDown({if ($_.KeyCode -eq “Escape”)

    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = “OK”

    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = “Cancel”

    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,45)
    $objLabel.Text = “Please enter the IP or Name of your vCenter Server or standalone ESXi host:”

    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,65)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)

    $objForm.Topmost = $True

    $handler = {$objTextbox.Select()}
    [void] $objForm.ShowDialog()

    Disconnect-VIServer -Server $defaultVIServers -Confirm:$false -ErrorAction SilentlyContinue

    $vCenterConnection = Connect-VIServer $vCenter -ErrorAction Stop


    Catch [SystemException] {
    “caught a system exception”
    [Windows.Forms.MessageBox]::Show(“Exception caught: $_.”, “Exception”, [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Exclamation)
    Finally {


    Then after saving the script from the CLI I connected manually:

    connect-VIserver -server

    then after about 30 seconds I was prompted to login and I did so. After loggin in I changed directory to the new modified script loction and ran:


    The script ran and I was able to backup. The only thing that didnt work for me in the script was when I choose my destination directory it didn’t populate the text box. I had to type it in.

    Hope this helps!

Leave a Reply

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

ERROR: si-captcha.php plugin: GD image support not detected in PHP!

Contact your web host and ask them to enable GD image support for PHP.

ERROR: si-captcha.php plugin: imagepng function not detected in PHP!

Contact your web host and ask them to enable imagepng for PHP.