Skip to content

Instantly share code, notes, and snippets.

@TScalzott
Created December 27, 2018 14:52
Show Gist options
  • Save TScalzott/556984b1a187cd34b2409bfa0583f30f to your computer and use it in GitHub Desktop.
Save TScalzott/556984b1a187cd34b2409bfa0583f30f to your computer and use it in GitHub Desktop.
List VM Snapshots
Get-VM |
ForEach-Object {
$Snap = Get-Snapshot -VM $_
if (($Snap | Measure-Object).Count -gt 0) {
Format-Table $_.Name,
@{N = "Num Snaps"; E = {($Snap | Measure-Object).Count}},
@{N = "Total MB"; E = {($Snap | Measure-Object -Sum SizeMB).Sum}},
@{N = "Total GB"; E = {($Snap | Measure-Object -Sum SizeGB).Sum}}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment