VMware Cloud Community
TheVMinator
Expert
Expert
Jump to solution

Listing Snapshots

Is there a simple way to get a listing of all of the snapshots on all VMs and how old they are?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Sure, try like this

$now = Get-Date
Get-VM | Get-Snapshot | Select VM,Name,
 
@{N="Age";E={New-TimeSpan -Start $_.Created -End $now | Select -Expandproperty Days}}


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Try it like this

$now = Get-Date
Get-VM | Get-Snapshot | Select VM,Name, @{N="Age";E={New-TimeSpan -Start $_.Created -End $now}}


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

TheVMinator
Expert
Expert
Jump to solution

OK great thanks.  It is showing the age in the format:

9.19:10:46.8243403

where the snapshot in this case is 9 days old.

Can that be adjusted to just show 9 ?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Sure, try like this

$now = Get-Date
Get-VM | Get-Snapshot | Select VM,Name,
 
@{N="Age";E={New-TimeSpan -Start $_.Created -End $now | Select -Expandproperty Days}}


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

0 Kudos
TheVMinator
Expert
Expert
Jump to solution

works great thanks again

0 Kudos