PowerCLI for backup vDS

  • By :
  • Category : VMware

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Free(BSD)
Search for duplicated files

This will be short (but hopefully I will find more time to show entire process to search duplicated files together with some examples). In case you are searching for duplicated files I can recommend two software which actually rocks in openSource world

Azure
NFS issue, cannot be mounted or is not visible

The same kind of issue I have encountered numerous times while working across different environments and with various customers. The problem with NFS mounts connected from remote locations is so common. This issue extends beyond communication solely over WAN and also include connections between datacenters (DC) where we lack control …

Azure
Why Firefox is important and people should use this browser in 2024, my thoughts.

Can you remember the times when everyone was using Internet Explorer? Back in the ’90s and the early part of this century, Internet Explorer dominated the browser market. Software Incompatibility with Other Browsers Incompatibility issues with software and other browsers have been a persistent problem. Even in 2022, this remains …