• Jitendra Singh.

Clear Last VDI parent Snapshots


As we discussed how to get snap shot details for Parent VMs in our VDI environment. Now going forward its really important once A pool recompose operation is done and successfully validated we should delete oldest snapshot from all VDI Parent Machines.

this should be done with a small script as below

Import-Module Vmware.Vimautomation.Core

# Connect to vCenter server

connect-viserver "vcsa01.vclass.local" -username vclass\admin -password ######

# Now Fetch fodlers where VMs reside in vCenter inventory

$foldername = "test"

$VM = get-vm -location $foldername | Select -ExcluedeProperty Name

foreach ($VM in $VM)

{

$totalsnap=get-snapshot -vm $VM

$tobedeleted=$totalsnap[0]

remove-snapshot -Snapshot $tobedeleted -Confirm: $false;

}

above script will delete oldest snap shot from all parent machines under test folder.

Make sure above script is running after recompose activity is done with latest snap shot and validations are done.

you may save this script one as .ps1 file and run as a scheduled task from a windows server.

recompose operation should run before scheduled time of excecution.

#vSphere #Automation #horizonview

205 views

Tel: +91-8879374285

 Bangalore INDIA 560076

© 2017-18 Xtra-V!rtual