Customer X: "Oh yeah, I forgot about those. Well: those updates we did worked out fine, so anything from before 11-07-2016 can be deleted"
Get-VM | Get-Snapshot | Where {$_.Created -lt (Get-Date 11-07-2016) | Remove-Snapshot -confirm:$false
Me: "OK, done!"
Another possibility: "Can you give me a list of snapshots that are older than a week?"
Get-VM | Get-Snapshot | Where {$_.Created -lt ((Get-Date).AddDays(-7))} | Select VM, Name
Did I say how much I love Powershell/PowerCLI? ;-)
No comments:
Post a Comment