Crafted this guy today because I've been forgetting to backup our ESXi hosts configs in quite a while.
I used a small part of the PowerCLI script to load the modules for this..
# Loads additional snapins and their init scripts
function LoadSnapins(){
$snapinList = @( "VMware.VimAutomation.Core", "VMware.VimAutomation.Vds", "VMware.VimAutomation.License", "VMware.DeployAutomation", "VMware.ImageBuilder", "VMware.VimAutomation.Cloud")
$loaded = Get-PSSnapin -Name $snapinList -ErrorAction SilentlyContinue | % {$_.Name}
$registered = Get-PSSnapin -Name $snapinList -Registered -ErrorAction SilentlyContinue | % {$_.Name}
$notLoaded = $registered | ? {$loaded -notcontains $_}
foreach ($snapin in $registered) {
if ($loaded -notcontains $snapin) {
Add-PSSnapin $snapin
}
}
}
LoadSnapins
$cred = Get-Credential
connect-viserver 1.2.3.4 -credential $cred
get-vmhost | get-vmhostfirmware -backupconfiguration -destinationpath "C:\vmware_backups"
pause
No comments:
Post a Comment