Thursday, April 13, 2017

Dealing with snapshots on Enterprise Hybrid Cloud; selectively remove/create snapshots

So I had a situation with one of my colleague dayakar today where he was implementing an EMC EHC and we had some trouble with our standard EHC script. we had to take snapshots. We had to first remove all the snapshots on these VMs.

get-vm | Get-Snapshot | Remove-Snapshot -RunAsync -Confirm:$false

 Now we needed to create snapshots only on those VMs with certain domain name.

$cluster = "" #cluster name(put * to include all clusters)
$domainname = "" #name domain of the vms
$snapshotName = "" #name of the snapshot
get-cluster $cluster | get-vm | where name -Match $domainname | New-Snapshot -RunAsync -Name $snapshotName -Confirm:$false

Now we needed to get the snapshots under vapps.

$cluster = "" #cluster name(put * to include all clusters)
$vapp = "" #name of the vapp
$snapshotName = "" #name of the snapshot
get-cluster $cluster | get-vapp -Name $vapp | get-vm | New-Snapshot -RunAsync -Name $snapshotName -Confirm:$false
 In case if you are wondering what is EHC, EHC is Enterprise Hybrid Cloud which is a cloud offering build with the following
compute : Cisco
Network : Cisco
Storage : EMC
Hypervisor: VMware vSphere
Cloud/Automation/Managment layer: vRealize Automation.
If you are in the market for a top of the notch cloud platform then have a look at it. We build it and it is awesome.