PowerShell script exchange
Post Reply
agrob
Veteran
Posts: 380
Liked: 48 times
Joined: Sep 05, 2011 1:31 pm
Full Name: Andre
Contact:

list all tape jobs within 24 hours

Post by agrob »

good day

is there a powershell function similar to this one:

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

to list all tape sessions?

Thanks
agrob
Veteran
Posts: 380
Liked: 48 times
Joined: Sep 05, 2011 1:31 pm
Full Name: Andre
Contact:

Re: list all tape jobs within 24 hours

Post by agrob »

found a "solution" myself, but nevertheless curious if there is a shorter solution

Code: Select all

$tapejobs = Get-VBRTapeJob
foreach ($job in $tapejobs) {
 $PreviousDay = [DateTime]::Now.AddHours(-24)
 [Veeam.Backup.Core.CBackupSession]::GetByJob($job.Id) | Where-Object {$_.EndTime -gt $PreviousDay -or $_.StartTime -gt $PreviousDay} | fl name
}
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: list all tape jobs within 24 hours

Post by oleg.feoktistov » 1 person likes this post

It's either with this .NET method or Get-VBRSession. But the object returned is more concise in this case and doesn't contain all the data available when returning CBackupSession with static method.
Thanks!
agrob
Veteran
Posts: 380
Liked: 48 times
Joined: Sep 05, 2011 1:31 pm
Full Name: Andre
Contact:

Re: list all tape jobs within 24 hours

Post by agrob »

Hello Oleg
Thanks. With Get-VBRSession i also need to specifiy a Job name or Id. I was searching for a easy Solution to get all Jobs without specify the job name or id. So something like get-vbrsession -all. but this seems not to be possible at the moment.
anyways, i have found the solution so far
regards
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: list all tape jobs within 24 hours

Post by oleg.feoktistov » 1 person likes this post

Andre,

I was almost ready to offer you [Veeam.Backup.Core.CBackupSession]::GetAll() method, but, as it turned out, it doesn't parse tape jobs at all.
So, that's what we've got for now.

Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests