Hello,
We have so many snapshots for multiple VMs that has the snapshot name: 'AAA_SNAPSHOT DDD.CCC.GGG.com 4572373973'.
But the last part (4572373973) is different for all the VMs.
Is there a way we can delete those snapshots for all the VMs by selecting only this first part in the below script : 'AAA_SNAPSHOT DDD.CCC.GGG.com'
I got the below script from LucD for deleting the snapshots.
$vmlist = Get-Content "C:\VM\Snapshots\vmlists.txt"
foreach($VM in $VMlist) {
Get-Snapshot -VM $vm -Name 'Prior to install VM Hardware' |
Remove-Snapshot -Confirm:$false
}
Disconnect-VIServer -Confirm:$false
Try like this
foreach($VM in $VMlist) {
Get-Snapshot -VM $vm -Name "AAA_SNAPSHOT DDD.CCC.GGG.com*" |
Remove-Snapshot -Confirm:$false
}
Disconnect-VIServer -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try like this
foreach($VM in $VMlist) {
Get-Snapshot -VM $vm -Name "AAA_SNAPSHOT DDD.CCC.GGG.com*" |
Remove-Snapshot -Confirm:$false
}
Disconnect-VIServer -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you very much!