Backup all ESXi by Carter Shanklin 29 months ago (modification of post by Carter Shanklin view diff)
diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1559"></script>download | new post
Back up all your ESXi hosts to a local directory.
- # Change this to where you would like your backups to go.
- # There is no versioning so backup theses backups with real backup software (e.g. on an SMB share).
- $backupDir = "c:\backups"
- # Get just your ESXi hosts.
- $esxiHosts = Get-VMHost | Where { $_ | Get-View -Property Config | Where { $_.Config.Product.ProductLineId -eq "embeddedEsx" } }
- # Back them all up.
- $esxiHosts | Foreach {
- $fullPath = $backupDir + "\" + $_.Name
- mkdir $fullPath -ea SilentlyContinue | Out-Null
- Set-VMHostFirmware -VMHost $_ -BackupConfiguration -DestinationPath $fullPath
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
PowerShell Code Repository