Hi all,
for those who want to create a backup of their VMware host configurations, I have created a simple script that uses the PowerCLI to create a backup of your host config.
You can find the module here: https://github.com/mkevenaar/Veeam/tree/main/VMware
This module allows you to export host configurations (HostFirmware) of all your VMHosts in your vCenter environment.
This requires VMware.PowerCLI. Easy to install using Chocolatey
choco install vmware-powercli-psmodule
example usage
Make changes to settings.ps1
as required, multiple vCenter servers are supported
Import-Module c:\Path\To\VMware.Backup.psm1
Get-Backups
You can change the location where to store the backups in the settings.ps1
file, location is up to you as long as the user executing the script has access to that folder. You can use a Backup Copy Job or the backup of the VM to make extra copies of your host configs.
Obviously, make sure that you do not store the data on the same VMware hosts as you are backing up.
Restore
Currently I do not have a PowerShell script to restore. (I will create that one day). However this should work:
Add the host to the vCenter Server using your normal methods
Change the commands below to your needs and execute these in the PowerCLI window
Connect-VIserver -Server myvcenter.mydomain.tld -Protocol "https" -User "myuser" -Password "mypassword"
Set-VMHost -VMHost myhost.mydomain.tld -State "Maintenance"
Set-VMHostFirmware -VMHost myhost.mydomain.tld -Restore -Force -SourcePath c:\backup\VMware\myvcenter.mydomain.tld\mydc1\configBundle-myhost.mydomain.tld.tgz
More info on used commandlets:
https://developer.vmware.com/docs/powercli/latest/vmware.vimautomation.core/commands/get-vmhost/
https://developer.vmware.com/docs/powercli/latest/vmware.vimautomation.core/commands/set-vmhost/