PowerShell script exchange
Post Reply
jnap
Enthusiast
Posts: 56
Liked: 4 times
Joined: Feb 11, 2020 4:54 pm
Contact:

Get-vbrBackupsession getting too much time

Post by jnap »

Hello,
Since we have upgraded from V10 to V11a, it seems that the cmdlet Get-VBRBackupSession especially used with that filter:

Code: Select all

Get-VBRBackupSession  | Where {$_.jobId -eq $job.Id.Guid -and $_.EndTime -ge (Get-Date).addhours(-24) } | Sort EndTimeUTC -Descending
is taking too much time to execute ...
Our entire script was taking 25/30min to execute in V10 and now it can take 4 to 5 hours...
And every day it s taking much time...

How can we replace that with a faster cmdlet ...? and why in veeam11 it's slower to execute that...?

Thanks! :)
oleg.feoktistov
Veeam Software
Posts: 1924
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get-vbrBackupsession getting too much time

Post by oleg.feoktistov »

Hi,

It definitely doesn't sound like an expected performance. Haven't noticed such issues with this cmdlet after upgrading my lab to v11 though. Just to clarify - how many sessions do you approximately have?

Thanks,
Oleg
jnap
Enthusiast
Posts: 56
Liked: 4 times
Joined: Feb 11, 2020 4:54 pm
Contact:

Re: Get-vbrBackupsession getting too much time

Post by jnap » 1 person likes this post

Hello,

I have corrected it by replacing the cmdlet by this:

Code: Select all

 [Veeam.Backup.Core.CBackupSession]::GetByJob($job.id) | where {$_.State -eq 'Stopped'-and $_.EndTime -ge (Get-Date).addhours(-24)}| Sort EndTimeUTC -Descending
and now the script is taking 5min to execute...
I have 30 Bkp Jobs, 1 backup per day for each job and 1500VMs backed up
oleg.feoktistov
Veeam Software
Posts: 1924
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get-vbrBackupsession getting too much time

Post by oleg.feoktistov »

Makes sense, GetByJob() method fetches table record with the corresponding job id directly, while Get-VBRBackupSession returns all the records first. So, how many sessions in total do you have then approx? In my case I had around 7500 backup sessions returned in about 7 minutes. And that's with a remote VBR console.
Anyways, I would advise to contact our support, share logs and investigate it deeper. As I said earlier, it doesn't look expected, nor can I say I experienced the same issue upon upgrade to v11. The last time Get-VBRBackupSession was confirmed to be slow was in 9.5 version because of some excessive queries to a database made.

Thanks!
jac_607
Novice
Posts: 3
Liked: never
Joined: Jul 19, 2021 9:53 pm
Full Name: Jonathan C
Contact:

Re: Get-vbrBackupsession getting too much time

Post by jac_607 »

jnap wrote: Nov 18, 2021 4:12 pm Hello,

I have corrected it by replacing the cmdlet by this:

Code: Select all

 [Veeam.Backup.Core.CBackupSession]::GetByJob($job.id) | where {$_.State -eq 'Stopped'-and $_.EndTime -ge (Get-Date).addhours(-24)}| Sort EndTimeUTC -Descending
and now the script is taking 5min to execute...
I have 30 Bkp Jobs, 1 backup per day for each job and 1500VMs backed up

Thank you! I wrote a post-job script that runs the Veeam validator tool against all backed up items in a job, but the get-vbrbackupsession cmdlet was taking far too long. GetByJob() works much better now!
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests