{"id":579,"date":"2019-11-21T14:24:00","date_gmt":"2019-11-21T14:24:00","guid":{"rendered":"http:\/\/labiol.xyz\/?p=579"},"modified":"2019-12-31T14:28:58","modified_gmt":"2019-12-31T14:28:58","slug":"powercli-for-backup-vds","status":"publish","type":"post","link":"https:\/\/www.labiol.xyz\/index.php\/2019\/11\/21\/powercli-for-backup-vds\/","title":{"rendered":"PowerCLI for backup vDS"},"content":{"rendered":"\n<p>Everyone -maybe besides my wife, but I wouldn&#8217;t bet on it \ud83d\ude09 knows that vitual distributed switches are extremely important in VMware world. <\/p>\n\n\n\n<p>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: <a href=\"https:\/\/kb.vmware.com\/s\/article\/1010555\">https:\/\/kb.vmware.com\/s\/article\/1010555<\/a><\/p>\n\n\n\n<p>Anyway, besides lots of advantages, vDS can be pain in the ass if something happen to them. And bad things happen, rarely but &#8230;  You need always to be prepared. Specially during operation with vCenter (and PSC) like upgade or reconfiguration.  <\/p>\n\n\n\n<p>Fortunately starting from vCenter 5.5 (if I can remember well) we have a way to backup vDS independently from vCenter database. <\/p>\n\n\n\n<p>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?<br>Please remember to change the path variable.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>if($global:DefaultVIServers.Count -gt 0) {<br>         write-host \"Jeste\u015b pod\u0142\u0105czony do vcenter:\" $global:DefaultVIServers[0].name<br> } else {<br>         write-host \"You are not connected to any vCenter. Connect to vCenter by using connect-viserver command.\"<br>         Break<br> }<\/code><\/p><p><code>$date = (Get-Date).ToString(\"yyyy-MM-dd\")<br> $path = \"e:\\vds-backup\\\"<br> $i=0<br>while ($i -ne 1) {<br>         $fullpath = $path + \"\\\" + $date<br>         if(Get-Item -Path $fullpath -ErrorAction SilentlyContinue){<br>                 $date = $date + \"_\"<br>         }<br>         else{<br>                 New-Item -ItemType Directory -Path I:\\install_it\\vmware\\dumpy\\vds\\$date<br>                 foreach ( $vds in get-vdswitch ) { Export-VDSwitch $vds -Description $vds.name -Destination \"$fullpath\\$vds.zip\" }<br>                 $i=1<br>         }<br> }<\/code><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Everyone -maybe besides my wife, but I wouldn&#8217;t bet on it \ud83d\ude09 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, &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-579","post","type-post","status-publish","format-standard","hentry","category-vmware"],"_links":{"self":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=579"}],"version-history":[{"count":8,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/579\/revisions"}],"predecessor-version":[{"id":589,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/579\/revisions\/589"}],"wp:attachment":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}