VMware Cloud Community
prashu_vocera
Contributor
Contributor

List all snapshots recursively and delete older than 7 days

Hi All ,

I got a tasks to list all snapshots recursively (folder depth upto 10) and delete all the snapshots older than 7days .

Can i get help on this ?

Thanks in advance

 

-prashnth

0 Kudos
1 Reply
LucD
Leadership
Leadership

You mean something like this

Get-VM | Get-Snapshot |
where{$_.Created -lt (Get-Date).AddDays(-7)} |
Remove-Snapshot -confirm:$false


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos