PowerShell script exchange
Post Reply
damind
Novice
Posts: 8
Liked: never
Joined: Sep 25, 2012 7:47 pm
Contact:

How to search the Action information?

Post by damind »

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?
tsightler
VP, Product Management
Posts: 6012
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: How to search the Action information?

Post by tsightler »

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
    }
}
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests