PowerShell script exchange
Post Reply
vicentin
Novice
Posts: 4
Liked: never
Joined: Mar 09, 2020 3:49 pm
Contact:

[ID# 04198762] Unable to get Synthetic Fulls date through powershell

Post by vicentin »

I am trying to know the date of the synthetics fulls performed by Veeam B&R successfully for a certain job. In order to do that, I get the list of sessions of that job with:

Code: Select all

$JobSessions = [Veeam.Backup.Core.CBackupSession]::GetByJob($Job.Id)

Then, I can get the desired information with:

foreach($Session in $JobSessions)
{
If ($Session.SessionInfo.SessionAlgorithm -eq "SynteticFull" -and
$Session.SessionInfo.Result -eq "Success")
{
Write-Host($Session.CreationTime, $Session.JobName)
}
}
At that point, I find a problem. When the job is a normal backup job, the script runs smoothly and the information is correct. However, when the job is an Agent backup job, the "$Session.SessionInfo.SessionAlgorithm" parameter always returns "Unknown", so I cannot distinguish the type of backup (Incremental, Full or Synthetic).

I have also used the cmdlet "Get-VBRBackupSession" to get the Backup/Backup Copy/Replica job sessions, and the cmdlet "Get-VBREPSession" to get the Agent for Microsoft Windows jobs session.

Why does "$Session.SessionInfo.SessionAlgorithm" returns always "Unknown"? Is there any way to workaround it?
Thank you
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: [ID# 04198762] Unable to get Synthetic Fulls date through powershell

Post by oleg.feoktistov »

Hi and Welcome to the Community Forums!

Get-VBRBackupSession is obsolete in regards to agent jobs. Get-VBRComputerBackupJobSession is now the dedicated one. However, there is no info on session algorithm there either. Try the code below to workaround it:

Code: Select all

$sessions = Get-VBRBackupSession | where {$_.JobType -eq 'EpAgentBackup' -or $_.JobType -eq 'EpAgentPolicy'}
foreach ($session in $sessions) {
    if ($session.SessionInfo.IsActiveFullMode -eq $false -and $session.SessionInfo.IsFullMode -eq $true) {
        $session | select Name, @{n='SyntheticFull';e={'true'}}
    }
} 

Thanks,
Oleg
vicentin
Novice
Posts: 4
Liked: never
Joined: Mar 09, 2020 3:49 pm
Contact:

Re: [ID# 04198762] Unable to get Synthetic Fulls date through powershell

Post by vicentin »

Hello Oleg and thanks for the response.
The code did not return anything. Every session returns ActiveFullMode=false and FullMode=false.
I suppose it is because the ActiveFullMode is always false, which is correct, but the FullMode is always false too, as I am trying to get only the Synthetic Fulls.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: [ID# 04198762] Unable to get Synthetic Fulls date through powershell

Post by oleg.feoktistov »

You're right. I figured that I had no agent jobs when tried this script. So, it returned 'True' for regular backup jobs.
Let me convert your question into feature request for Get-VBRComputerBackupJobSession then.
Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests