Skip to content

Instantly share code, notes, and snippets.

@pariswells
Created November 13, 2017 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pariswells/b8d027b954f570961ff4f92a25f363ce to your computer and use it in GitHub Desktop.
Save pariswells/b8d027b954f570961ff4f92a25f363ce to your computer and use it in GitHub Desktop.
snapshotfind.ps1
$Days = $%id%Days%id%
$Days = (get-date).adddays(-($Days))
$SnapshotList = $null
$SnapshotList = Get-VM | Get-VMSnapshot | where-object { $_.CreationTime -lt $Days }
if ($SnapshotList -eq $null)
{
$OverdueSnapshot = "NO Overdue Snapshot"
}
else
{
foreach ($EachSS in $SnapshotList)
{
$OverdueSnapshot += "$EachSS.VMName : $EachSS.Name : $EachSS.CreationTime : "
}
}
$%id%OverdueSnapshot%id% = $OverdueSnapshot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment