PowerShell script exchange
Post Reply
tedossantos
Influencer
Posts: 12
Liked: 1 time
Joined: Dec 20, 2021 1:13 pm
Full Name: Telmo Eduardo Dos Santos
Contact:

Get-VbrBackupSession show old values, not last sessions

Post by tedossantos »

When I run in powershell the command:
Get-VbrBackupSession | where-object {$_.JobName -eq "job name"}

Job Name State Start Time End Time Result
-------- ----- ---------- -------- ------
job name (Full) Stopped 06/03/2023 11:28:25 06/03/2023 11:28:51 Failed,

this shows old value ​​and not the last session, this happens already a month ago.

has it ever happened to you?
ronnmartin61
Veeam Software
Posts: 441
Liked: 131 times
Joined: Mar 07, 2016 3:55 pm
Full Name: Ronn Martin
Contact:

Re: Get-VbrBackupSession show old values, not last sessions

Post by ronnmartin61 »

Without specifying a sort order this isn't too surprising. Try sorting the output -

Code: Select all

Get-VbrBackupSession | where-object {$_.JobName -eq "job name"} | Sort-Object -Property EndTime -Descending
tedossantos
Influencer
Posts: 12
Liked: 1 time
Joined: Dec 20, 2021 1:13 pm
Full Name: Telmo Eduardo Dos Santos
Contact:

Re: Get-VbrBackupSession show old values, not last sessions

Post by tedossantos »

Yes, as you say, it is with the command and performing a sorting, sorry for having put it wrong in the initial post

PS C:\Users\admabast1> Get-VbrBackupSession | where-object {$_.JobName -eq "job name"} | Sort-Object -Property EndTime -Descending

Job Name State Start Time End Time Result
-------- ----- ---------- -------- ------
job name Stopped 06/03/2023 11:28:25 06/03/2023 11:28:51 Failed
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Get-VbrBackupSession show old values, not last sessions

Post by david.domask »

Hi @tedossantos,

Is this an agents item you're checking or a Hypervisor backups? The filtering on the Job Name might be matching on another similarly named job.

Can you try Where-Object {$_.JobID -eq 'id of the desired job'}?

You can get the job ID from Get-VBRJob/Get-VBRComputerBackupJob
David Domask | Product Management: Principal Analyst
tedossantos
Influencer
Posts: 12
Liked: 1 time
Joined: Dec 20, 2021 1:13 pm
Full Name: Telmo Eduardo Dos Santos
Contact:

Re: Get-VbrBackupSession show old values, not last sessions

Post by tedossantos »

Hi @david.domask,

it's a windows agent backup.

When I run the command:
Get-VBRJob -Name "job name"

Job Name Type State Last Result
-------- ---- ----- -----------
job Name Windows Agen... Stopped Success

the Last Result does appear as succesful

but when i run

Get-VbrBackupSession | where-object {$_.JobID -eq "job_ID"} | Sort-Object -Property EndTime -Descending

Now nothing is displayed.
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Get-VbrBackupSession show old values, not last sessions

Post by david.domask »

Try using the Get-VBRComputerBackupJob and Get-VBRComputerBackupJobSession: https://helpcenter.veeam.com/docs/backu ... ml?ver=120

Get-VBRJob is technically deprecated for retrieving Agents based backups, and my guess is that you're also seeing some older things like policy retries returned.

Get the JobID of the Agent Job you want to track, and filter with | Where-Object {$_.JobId -eq 'id of the job you want to check'}
David Domask | Product Management: Principal Analyst
tedossantos
Influencer
Posts: 12
Liked: 1 time
Joined: Dec 20, 2021 1:13 pm
Full Name: Telmo Eduardo Dos Santos
Contact:

Re: Get-VbrBackupSession show old values, not last sessions

Post by tedossantos »

I think both commands were not yet implemented in my version of veeam (9.5u4)

+ Get-VBRComputerBackupJob
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-VBRComputerBackupJob:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

En línea: 1 Carácter: 1
+ Get-VBRComputerBackupJobSession
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-VBRComputerBackupJobSession:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Get-VbrBackupSession show old values, not last sessions

Post by david.domask »

AH, sorry, I didn't realize you were on an older version.

To be honest, the cmdlets from that time were not optimized as well for Agents based items (it was in development at that time), so I think it would be best if:

1. Upgrade to a newer version is possible: I realize this is pretty significant, but 9.5U4 is End of Support and Fix and Life, and likely it's going to be a bit of work to dig up the old documentation on this.
2. You might want to try unsupported methods here. Get the JobID with Get-VBRJob, then check the output of

[Veeam.Backup.Core.CBackupSession]::GetAll()

Check the properties and you should be able to filter on some of those properties and find the information you want based on the JobID.
David Domask | Product Management: Principal Analyst
tedossantos
Influencer
Posts: 12
Liked: 1 time
Joined: Dec 20, 2021 1:13 pm
Full Name: Telmo Eduardo Dos Santos
Contact:

Re: Get-VbrBackupSession show old values, not last sessions

Post by tedossantos »

Something wrong with the database, with [Veeam.Backup.Core.CBackupSession]::GetAll() the last sessions do not appear.
however with Get-VBRJob yes.
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Get-VbrBackupSession show old values, not last sessions

Post by david.domask »

Sorry to hear it; is upgrading to a Supported Version possible by chance or you can't due to license/older devices you need to continue to work with?

Just as noted, it will be very difficult to advise without seeing what's actually in your Configuration Database and your full code. With an upgrade, we can check it out on a case.
David Domask | Product Management: Principal Analyst
tedossantos
Influencer
Posts: 12
Liked: 1 time
Joined: Dec 20, 2021 1:13 pm
Full Name: Telmo Eduardo Dos Santos
Contact:

Re: Get-VbrBackupSession show old values, not last sessions

Post by tedossantos »

We try de upgrade, thanks for youre help
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Get-VbrBackupSession show old values, not last sessions

Post by david.domask »

Happy to advise and glad it's possible.

If you still have issues on a supported version, update the thread with your current script and I'll do what I can to advise.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests