Created
November 13, 2017 06:01
-
-
Save pariswells/b8d027b954f570961ff4f92a25f363ce to your computer and use it in GitHub Desktop.
snapshotfind.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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