Why powercli?
A lot of what I've seen out there for backing up the host configuration uses VMA or Vcli but I use powercli more consistently as I know a lot of other people do also.
Here is the code to backup your esxi host via powercli
Get-VMHostFirmware -VMHost $host -BackupConfiguration -DestinationPath C:\DownloadFolder
Set-VMHostFirmware -VMHost $Host -Restore -SourcePath c:\bundleToRestore.tgz -HostUser user -HostPassword pass
*note: that the backup config files can be restored only to the same version of esxi and same build.
I havent tested otherwise but posts on different blogs confirm that.
Pre-backup evidence
Test host: before backing up
Here are some configs that I want to see go over after restoring
Backing up the config
Connect to your host/vcenter first
Using:
Get-VMHostFirmware -VMHost $host -BackupConfiguration -DestinationPath C:\Downloads
Pasted from <http://www.vmware.com/support/developer/PowerCLI/PowerCLI41U1/html/Get-VMHostFirmware.html>
Here is what is backed up, its tiny!
Installing ESXi
Here is the new install booting from dhcp
Restoring Using:
Set-VMHost -VMHost Host -State 'Maintenance'
Set-VMHostFirmware -VMHost Host -Restore -SourcePath c:\bundleToRestore.tgz -HostUser user -HostPassword pass
Set-VMHostFirmware -VMHost Host -Restore -SourcePath c:\bundleToRestore.tgz -HostUser user -HostPassword pass
Pasted from <http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Set-VMHostFirmware.html>
Connected to esxi host
Place into maintenance mode
I had to use the force optionotherwise I was getting Restore failed: fault.MismatchedBundle.summary
Figuredd that out thanks to here : http://www.php2s.com/virtualization/esxi-4-backup-and-restore-configuration.html
Server came up by itself:
Here is the console
Here are the settings in the vmware client
Looks like I will have to add the nic manually to the switch labeled vswitch1
It knows the NTP time setting
Conclusion:
It can be a great timesaver if you have a lot of settings to redo.
*notes:
*Note was readig that this cant be used to restore the config to a different system because you will get a fault.MismatchedBundle.summary because the nic macs are different
I havent tried that with the force option so it might work…..
0 comments:
Post a Comment