@@ -27,32 +27,41 @@ function Get-AbrOntapVserverVolumeSnapshotHealth {
2727 }
2828
2929 process {
30- $SnapshotDays = 7
31- $Now = Get-Date
32- $VserverFilter = Get-NcVol - VserverContext $Vserver - Controller $Array | Where-Object {$_.JunctionPath -ne ' /' -and $_.Name -ne ' vol0' }
33- $SnapShotData = get-ncsnapshot - Volume $VserverFilter - Controller $Array | Where-Object {$_.Name -notmatch " snapmirror.*" -and $_.Created -le $Now.AddDays (- $SnapshotDays )}
34- $VserverObj = @ ()
35- if ($SnapShotData ) {
36- foreach ($Item in $SnapShotData ) {
37- $inObj = [ordered ] @ {
38- ' Volume Name' = $Item.Volume
39- ' Snapshot Name' = $Item.Name
40- ' Created Time' = $Item.Created
41- ' Used' = $Item.Total | ConvertTo-FormattedNumber - Type Datasize - ErrorAction SilentlyContinue
42- }
43- $VserverObj += [pscustomobject ]$inobj
44- }
30+ try {
31+ $VserverFilter = Get-NcVol - VserverContext $Vserver - Controller $Array | Where-Object {$_.JunctionPath -ne ' /' -and $_.Name -ne ' vol0' }
32+ $SnapShotData = get-ncsnapshot - Volume $VserverFilter - Controller $Array | Where-Object {$_.Name -notmatch " snapmirror.*" -and $_.Created -le $Now.AddDays (- $SnapshotDays )}
33+ if ($SnapShotData ) {
34+ Section - Style Heading4 " HealthCheck - Volumes Snapshot" {
35+ Paragraph " The following section provides the Vserver Volumes Snapshot HealthCheck on $ ( $SVM ) ."
36+ BlankLine
37+ $SnapshotDays = 7
38+ $Now = Get-Date
39+ $VserverObj = @ ()
40+ foreach ($Item in $SnapShotData ) {
41+ $inObj = [ordered ] @ {
42+ ' Volume Name' = $Item.Volume
43+ ' Snapshot Name' = $Item.Name
44+ ' Created Time' = $Item.Created
45+ ' Used' = $Item.Total | ConvertTo-FormattedNumber - Type Datasize - ErrorAction SilentlyContinue
46+ }
47+ $VserverObj += [pscustomobject ]$inobj
48+ }
4549
46- $TableParams = @ {
47- Name = " HealthCheck - Volume Snapshot over 7 days only - $ ( $Vserver ) "
48- List = $false
49- ColumnWidths = 25 , 35 , 25 , 15
50- }
51- if ($Report.ShowTableCaptions ) {
52- $TableParams [' Caption' ] = " - $ ( $TableParams.Name ) "
53- }
50+ $TableParams = @ {
51+ Name = " HealthCheck - Volume Snapshot over 7 days - $ ( $Vserver ) "
52+ List = $false
53+ ColumnWidths = 25 , 35 , 25 , 15
54+ }
55+ if ($Report.ShowTableCaptions ) {
56+ $TableParams [' Caption' ] = " - $ ( $TableParams.Name ) "
57+ }
5458
55- $VserverObj | Table @TableParams
59+ $VserverObj | Table @TableParams
60+ }
61+ }
62+ }
63+ catch {
64+ Write-PScriboMessage - IsWarning $_.Exception.Message
5665 }
5766 }
5867
0 commit comments