-
- Enthusiast
- Posts: 83
- Liked: 9 times
- Joined: Oct 31, 2013 5:11 pm
- Full Name: Chris Catlett
- Contact:
FIX Get-VBRSession cmdlet in v9
Case #01882938
(For Disk & Copy Sessions)
Get-VBRBackupSession does not require you to specify a job name to look up sessions.
(For Tape Sessions)
Get-VBRSession (why is it not Get-VBRTapeSession ??) requires you to specify a job.
Whats worse, is that you can't pipe Get-VBRTapeJob to Get-VBRSession....
Get-VBRTapeJob returns the "job name" as the 'Name' property
Get-VBRSession expects it to be in the 'Job' property
Its looking for a property with a type of "Veeam.Backup.PowerShell.Infos.VBRJob", so I can't even use an expression to fix the naming.
(For Disk & Copy Sessions)
Get-VBRBackupSession does not require you to specify a job name to look up sessions.
(For Tape Sessions)
Get-VBRSession (why is it not Get-VBRTapeSession ??) requires you to specify a job.
Whats worse, is that you can't pipe Get-VBRTapeJob to Get-VBRSession....
Get-VBRTapeJob returns the "job name" as the 'Name' property
Get-VBRSession expects it to be in the 'Job' property
Its looking for a property with a type of "Veeam.Backup.PowerShell.Infos.VBRJob", so I can't even use an expression to fix the naming.
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: FIX Get-VBRSession cmdlet in v9
It's an expected behaviour, indeed.Get-VBRSession requires you to specify a job.
We plan to expand its capabilities down the road. Thus, the general name.why is it not Get-VBRTapeSession ?
This one doesn't look expected. Let me double check that internally.Whats worse, is that you can't pipe Get-VBRTapeJob to Get-VBRSession....
Thanks.
-
- Enthusiast
- Posts: 83
- Liked: 9 times
- Joined: Oct 31, 2013 5:11 pm
- Full Name: Chris Catlett
- Contact:
Re: FIX Get-VBRSession cmdlet in v9
Thanks for the quick reply, I'm alright with the generalized naming and the need to specify a job (so long as I can pipe to it.)
I'm trying to use this for some custom reporting I do through powershell, and need to get the most recent tape session for each job (since the job object doesn't store the last time it was executed, even though it stores the result.)
I'm trying to use this for some custom reporting I do through powershell, and need to get the most recent tape session for each job (since the job object doesn't store the last time it was executed, even though it stores the result.)
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: FIX Get-VBRSession cmdlet in v9
Hmm, may be this example can help you a bit:
Thanks.
Code: Select all
foreach ($TapeJob in (Get-VBRTapeJob))
{
Get-VBRSession -Job $TapeJob -Last | select -Property @{N="Name"; E={((Get-VBRTapeJob) | where {$_.Id -eq $TapeJob.id}).name}}, @{N="Result"; E={$_.Result}}, @{N="EndTime"; E={$_.EndTime}}
}
-
- Enthusiast
- Posts: 83
- Liked: 9 times
- Joined: Oct 31, 2013 5:11 pm
- Full Name: Chris Catlett
- Contact:
Re: FIX Get-VBRSession cmdlet in v9
Doesn't work for "continuous jobs", they show an 'endtime' of 1/1/1900
Also the below is much more efficient:
Also the below is much more efficient:
Code: Select all
$jobs = Get-VBRTapeJob
$colinfo = @()
foreach ($TapeJob in $jobs)
{
$info = Get-VBRSession -Job $TapeJob -Last | select -Property @{N="Name"; E={($jobs | where {$_.Id -eq $TapeJob.id}).name}}, @{N="Result"; E={$_.Result}}, @{N="EndTime"; E={$_.EndTime}}
$colinfo +=$info
}
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: FIX Get-VBRSession cmdlet in v9
Not sure how the provided script is much more efficient since the only difference it has compared to the previously posted example is the fact that it saves the result to a variable. Anyway, it's up to you to leverage whatever one you want to. Thanks.
-
- VP, Product Management
- Posts: 6035
- Liked: 2860 times
- Joined: Jun 05, 2009 12:57 pm
- Full Name: Tom Sightler
- Contact:
Re: FIX Get-VBRSession cmdlet in v9
Not having to call Get-VBRTapeJob in the pipe output is likely quite a big boost in efficiency, especially in a large environment. Even better would be store the initial result in a hash table and cycle over the hashes, which would pipe only the minimum needed during each loop, but now we're getting way off topic.v.Eremin wrote:Not sure how the provided script is much more efficient since the only difference it has compared to the previously posted example is the fact that it saves the result to a variable. Anyway, it's up to you to leverage whatever one you want to. Thanks.
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: FIX Get-VBRSession cmdlet in v9
Ahh, almost always forget about that aspect and the fact that there are infrastructures with more than one library and more than two tape jobs.
Who is online
Users browsing this forum: Semrush [Bot] and 14 guests