You can back up and restore a VMware ESXi host configuration with PowerCLI. In this post, I show you what commands you need and what things you have to consider when you restore a backup to an ESXi host
Profile gravatar of Vladan Seget

Vladan Seget

Vladan Seget is as an independent consultant, professional blogger, vExpert 2009-2016, VCAP5-DCA/DCD, VCP, and MCSA. He has been working for over 15 years as a system engineer.
Profile gravatar of Vladan Seget

Note: You can also back up and restore ESXi host configurations with the vSphere Command-Line Interface (vSphere CLI or vCli). This VMware KB article explains the details.

If you want to perform a backup with PowerCLI, you first have to download the module from VMware to your management machine. If you don't have a My VMware account, you can create one for free.

After you install the PowerCLI module, you can connect to your host with the following command. Replace the IP address with that of your ESXi host.

It will prompt you for your username and password unless your ESXi host and your management machine are Active Directory domain members. Of course, your account requires sufficient privileges to connect. Note that you might get a yellow text warning about invalid certificates unless you're using your own, not the self-issued certificate from VMware.

Then you have to execute this command:

ESXi_host_IP_address is the IP address of the ESXi host and output_directory is the name of the directory where it will create the output file.

Here is an example from my lab:

Note: You must create the C:\Download folder manually before executing the command.

Back up an ESXi configuration via PowerCLI

Back up an ESXi configuration via PowerCLI

Now you can check the download folder to ensure the backup file exists. It should look have the extension .tgz and start with "configBundle."

What does the backup file contain? ^

The backup file is compressed. You can extract it with a tool like 7‑Zip, which handles .rar and .tgz extensions. The information in the backup file is quite comprehensive. It contains many small configuration files, SSL certificates, storage configurations, iSCSI settings, VMware cluster configurations, and so on.

Contents of the backup file

Contents of the backup file

How to restore the configuration ^

If you want to restore a previously backed-up configuration to an ESXi host, the host has to be reachable over the network. Thus, if you installed a new host, you have to configure the network settings at least before you can restore the backup.

First you have to put your host into a maintenance state via the vSphere client or with this PowerCLI command:

After that, you can back up your host with this command:

If you're restoring to different hardware or a different build, you might need to add the "force" switch:

That's basically it. Note that the host will reboot after applying the new configuration.

What if VMs were registered on the host? ^

In case virtual machines were running on this ESXi host, you'll have to register them again by using the datastore browser. After you right-click the VMX configuration file, you'll see the option Add to Inventory. The backup does not store information about VMs; thus, you'll need to re-inventory them.

Wrap-up ^

The backup process described in this post can be useful for small environments where you want to secure the configurations of individual hosts. However, for large environments and for networks with Enterprise Plus licenses, you'd probably use VMware Host Profiles to maintain a homogenous configuration across all of your hosts. You'll probably also be using Auto Deploy and stateful or stateless options to maintain your hosts without the need to maintain the configuration at the host level.

Win the monthly 4sysops member prize for IT pros

Share
5+

Users who have LIKED this post:

  • avatar
  • avatar
  • avatar
  • avatar

Related Posts

0 Comments

Leave a reply

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

*

CONTACT US

Please ask IT administration questions in the forum. Any other messages are welcome.

Sending
© 4sysops 2006 - 2017

Log in with your credentials

or    

Forgot your details?

Create Account