- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you change "Get-VM" into "Get-VM -Name YourVMName" you get only one VM instead of all. Before you can use these commands you have to connect to a vCenter or ESX server with the Connect-VIserver cmdlet. To make the code complete for one VM it will be:
Connect-VIServer -Server YourvCenterServerName
Get-VM -Name YourVMName | `
Get-Snapshot | `
Where-Object { $_.Created -lt (Get-Date).AddDays(-3) } | `
Remove-Snapshot
Robert
Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition