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.

Linux
Migrate WordPress site to another hosting service.

IntroductionThis article details the migration of WordPress site (exactly this site you are now on) from one service provider to Amazon Lightsail. There might be various reason to do that (mine is outlined below) but in general I hope to share the message that especially with WordPress, migration can be …

VMware
VMware Workstation and Fusion can be installed and use for free (even for the enterprise)

For a while now, the VMware Workstation (and Fusion for MacOS) can be used without any additional fee for Personal use. That was a great Broadcom news and nice gesture from that software vendor. Recently Broadcom announced that the software will be available for all, even the commercial sector. This …

Linux
Salt, VMware implementation – part 1, introduction

As every IT administrator knows, the infrastructure (meaning storages, compute, VMware virtualisation stack) is just a fundaments to run various operating systems (OS) and finally (containerized) application. Therefore, installation of (let’s call it) infrastructure in the datacenter (SDDC), in that sense is just the beginning of the adventure. No wonder, …