How to search the Action information?

PowerShell script exchange

How to search the Action information?

Veeam Logoby damind » Mon Apr 04, 2016 8:49 pm

Hello All,

I am trying to determine the health of CBT for my backups and replications. One recent replication job contains the following item in the Action column for a VM: "CBT data is invalid, failing over to legacy incremental backup. No action is required, next job run should start using CBT again. If CBT data remains invalid, follow KB1113 to perform CBT reset. Usual cause is power loss."

My goal is to develop a powershell script to search the "Action" messages for each VM for each job. However, I do not know how to search for the "Action" data. Can someone please point me to some documentation or examples of searching that data?
damind
Lurker
 
Posts: 2
Liked: never
Joined: Tue Sep 25, 2012 7:47 pm

Re: How to search the Action information?

Veeam Logoby tsightler » Tue Apr 05, 2016 12:42 am

The following script is a crude example that does roughly what you want and hopefully should be a good starting point. It grabs all task sessions in the last 7 days and list the VM name, job name, and task start time of any VM which failed CBT. The script could certainly be more robust as currently it's doing a simple string match on the task log data but that should also help you understand how it is possible to get at this data.

Code: Select all
$vbrtasksessions = Get-VBRBackupSession | Where-Object {$_.JobType -eq "Backup" -and $_.EndTime -ge (Get-Date).adddays(-7)} | Get-VBRTaskSession | Sort-Object {$_.JobSess.CreationTime}
 foreach ($task in $vbrtasksessions) {
    $cbt_fail = $null = $task.Logger.GetLog().UpdatedRecords.Title | Select-String "CBT data is invalid"
    if ($cbt_fail) {
        write-host $task.Name "had CBT error in job" $task.JobName "on" $task.JobSess.CreationTime
    }
}
tsightler
Veeam Software
 
Posts: 4767
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests