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.

VMware
VCF, backup configuration

Backup implementation for VMware component is fairly easy. Just the requirements is to configure SFTP server in proper way and make it network available to the VMware components. SDDC Manager and NSX Manager backup In VCF Operations it is possible to configure backup for SDDC Manager and NSX Manager. Go …

VMware
VCF Automation, fresh environment configuration with identity providers and access control.

Introduction Login Login as user admin to the Organization name: system or if selected manual: Check the connections (in Administration section), where you should see connection to the vCenter and NSX-t manager as those are provided automatically via VCF Operations: the same for VCF Instances: Also check your networking: Identity …

VMware
VCF SoS

SoS (Supportability and Serviceability) command can be used for troubleshooting purpose to generate VCF (per component) log bundle, massively enable/disable ssh service on ESXi, vCenter, password and certificates expiry status, verify cluster health and many other. while troubleshooting, the following commands can be helpful: