PowerShell script exchange
Post Reply
Vek17
Service Provider
Posts: 49
Liked: 15 times
Joined: May 29, 2018 8:42 pm
Contact:

Find Date of last HeathCheck/Compact

Post by Vek17 »

Is there a way to identify when a job has last completed a heathcheck/compact/merge/other meta operation other then parsing the session logger? What I am doing right now is extremely expensive and it seems like this data has to exist somewhere else but I haven't been able to find anything.

Currently doing:

Code: Select all

$SessionList = Get-CachedSessions | Where-Object {$_.JobID -eq $Job.ID -and $_.result -ne "None"} | Sort-Object creationtime -Descending
             ForEach($Sess in $SessionList){
                if($lastMerge -eq $null){
                    $lastMerge = (($Sess.Logger.GetLog().UpdatedRecords | where-Object {$_.Status -eq "ESucceeded" -and $_.Title -match "^Full backup file merge completed successfully"}).UpdateTime)
                    $dataMerge =  ($Sess.Logger.GetLog().UpdatedRecords | where-Object {$_.Status -eq "ESucceeded" -and $_.Title -match "^Full backup file merge completed successfully"})
                }
                if($lastCompact -eq $null){
                    $lastCompact = (($Sess.Logger.GetLog().UpdatedRecords | where-Object {$_.Status -eq "ESucceeded" -and $_.Title -match "^Full backup file compact completed successfully"}).UpdateTime)
                    $dataCompact =  ($Sess.Logger.GetLog().UpdatedRecords | where-Object {$_.Status -eq "ESucceeded" -and $_.Title -match "^Full backup file compact completed successfully"})
                }
                if ($lastHeathCheck -eq $null){
                    if(!($Sess.Logger.GetLog().UpdatedRecords | where-Object {$_.Title -match "^Failed to perform backup file verification"})){
                        $lastHeathCheck = (($Sess.Logger.GetLog().UpdatedRecords | where-Object {$_.Status -eq "ESucceeded" -and $_.Title -match "^Backup files health check has been completed"}).UpdateTime)
                        $dataHeathCheck =  ($Sess.Logger.GetLog().UpdatedRecords | where-Object {$_.Status -eq "ESucceeded" -and $_.Title -match "^Backup files health check has been completed"})
                    }
                }
                if(($lastMerge -ne $null) -and ($lastCompact -ne $null) -and ($lastHeathCheck -ne $null)){
                    break
                }
            }
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Find Date of last HeathCheck/Compact

Post by veremin »

I believe there is no easier way to get the information you're after. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests