VMware – Command line backup of ESXi config

Not being sure how I was going to use my lab while studying for the VCP5-DCV exam, I wanted to have a way to backup the configuration, so that if I exceeded the 60 day eval period, I would have a way of getting the configuration back without having to reconfigure everything. This is also something that is good to have to use with production vSphere server in the real world. This requires vCLI part to be installed on a client workstation. This was done using VMware-vSphere-CLI-5.5.0-1292267.exe. I went to this version of vCLI because I had problems with the 5.1 version running on my Windows 7 32 bit desktop.

To backup the configuration of a host, you will need to run this command – vicfg-cfgbackup -server ESXi-IP -username root -password password –save c:\dir\backupfile.txt. The first time I tried it, I got a message that the vicfg-cfgbackup command couldn’t be found. Once I added .pl to the vicfg-cfgbackup command, then it ran as expected.

To later restore the configuration of a host from a backup (without confirmation), you will need to use this command – vicfg-cfgbackup.pl -server ESXi-IP -username root -passwprd password –load c:\dir\backupfile.txt -q

You can go to this site that has the documentation for command line interface –
https://pubs.vmware.com/vsphere-55/index.jsp?topic=%2Fcom.vmware.vcli.ref.doc%2Fvicfg-cfgbackup.html. Although you wont need this for your lab on a day to day basis but it could be a career saving option when you are in a disaster recovery situation and you need every advantage you can get. Just a few notes to remember – change ESXi-IP to the ip address of the vSphere server that you are using this command against, change root to the name of the account you are using to access the vSphere server with that has sufficient rights and change password to the one you actually use for the account that you are accessing the vSphere account. I change the name of the backupfile.txt to reflect the name of the vSphere server that it is for. In case there are multiple backups for a server, I usually incorporate the date of the backup in the file name. Just in case there is a problem with DNS while backing up or restoring, I normally go with the ip address of the host instead of using the fqdn.

In addition to the online documentation that you can get to, you can also download a pdf of the same info by going to here – https://www.vmware.com/support/developer/vcli/.

When using vCLI and if there is a firewall between you and the vSphere server, you will want to make sure that port 443/tcp aka SSL is open on the firewall. It you still have problems with vCLI working even with doing this, you should check the firewall that may be running on the workstation you are using vCLI on as well as the firewall running on the vSphere server if you have made any changes to it.

I have seen some forum messages that give the impression that vCLI is going away. While that may happen at some point in the future, since it has been rereleased/updated for vSphere 5.5, I think it is safe to say it will be here for a while longer.

To read the rest of my posts in the VMware Series – Click on this link

Send to Kindle
This entry was posted in Blog Entries, VMware and tagged . Bookmark the permalink.