Everyone -maybe besides my wife, but I wouldn’t bet on it 😉 knows that vitual distributed switches are extremely important in VMware world.
Using it has a lot of advantages. vDS are more advanced than standard switches (SS), with much more features. You can read about it here: https://kb.vmware.com/s/article/1010555
Anyway, besides lots of advantages, vDS can be pain in the ass if something happen to them. And bad things happen, rarely but … You need always to be prepared. Specially during operation with vCenter (and PSC) like upgade or reconfiguration.
Fortunately starting from vCenter 5.5 (if I can remember well) we have a way to backup vDS independently from vCenter database.
The easiest way is to backup via web client or PowerCLI. Below you can find a simple script to backup all vDS in vCenter. Maybe it is worth to setup this in schedule?
Please remember to change the path variable.
if($global:DefaultVIServers.Count -gt 0) {
write-host "Jesteś podłączony do vcenter:" $global:DefaultVIServers[0].name
} else {
write-host "You are not connected to any vCenter. Connect to vCenter by using connect-viserver command."
Break
}
$date = (Get-Date).ToString("yyyy-MM-dd")
$path = "e:\vds-backup\"
$i=0
while ($i -ne 1) {
$fullpath = $path + "\" + $date
if(Get-Item -Path $fullpath -ErrorAction SilentlyContinue){
$date = $date + "_"
}
else{
New-Item -ItemType Directory -Path I:\install_it\vmware\dumpy\vds\$date
foreach ( $vds in get-vdswitch ) { Export-VDSwitch $vds -Description $vds.name -Destination "$fullpath\$vds.zip" }
$i=1
}
}
No Comments