I spent a little time today checking this item of my todo list. This script is based on some of the code from here but simplified so that it can run as a Scheduled Task.
Copy the above and save somewhere as a .ps1 file. Substitute your values for the variables at the top as appropriate. Uncomment the authentication bits if you don't want to connect as the current user (or the user running the Scheduled Task). If you only have a single ESXi host or aren't using vCenter then you can simplify things further and only run the Get-VMHostFirmware line with a specific -VMHost value specified, instead of looping over hosts found in vCenter.
Hopefully that's useful for others
Code:
Add-PSSnapin VMware.Vimautomation.Core -ea SilentlyContinue
#$user=""
#$pass=""
$vCenterServer="lynx.ad.niknak.org"
$SaveLocation="C:\vSphere Backups\"
Connect-VIServer -server $vCenterServer -ErrorAction Stop #-user $user -password $pass
$VMHosts = Get-VMHost | Where { (($_.ConnectionState -eq "connected") -or ($_.ConnectionState -eq "Maintenance")) }
foreach ($VMHost in $VMHosts)
{
Get-VMHostFirmware -VMHost $VMHost -BackupConfiguration -DestinationPath $SaveLocation -ErrorAction:SilentlyContinue
}
Disconnect-VIServer -Server $vCenterServer -Force:$true -Confirm:$false
Hopefully that's useful for others
