Get-VBRTaskSessions changes session info?

PowerShell script exchange

Get-VBRTaskSessions changes session info?

Veeam Logoby Backerupper » Sat Oct 15, 2016 7:22 pm

I am seeing something very odd that is not making sense to me.

Gather a (or some) backup sessions (in this case, successful backup sessions within the last 2 hours)
Output the session info
Notice Total (GB) equals 140 (as it should/confirmed)

Then gather tasksessions for that session
Output same exact session info
Notice Total (GB) is now 240 (double what it should be)

If you change one line and omit the Get-VBRTaskSession command everything outputs as expected (with $taskList now holding sessions and not tasksessions...).
$task = $session | Get-VBRTaskSession
to
$task = $session# | Get-VBRTaskSession


Is there any reason why running Get-VBRTaskSession would change the value?
Note - there is a handful of values that will double under session.progress not just this one


Code: Select all
$HourstoCheck = 2

# Gather all sessions
$allSessions = Get-VBRBackupSession
# Gather just successful backup sessions within $HourstoCheck
$successSessions = $allSessions | ?{$_.CreationTime -ge (Get-Date).AddHours(-$HourstoCheck) -and $_.JobType -eq "Backup" -and $_.Result -eq "Success"}

# Output Session Info
$successSessions | Select @{Name="Job Name"; Expression = {$_.Name}},
  @{Name="Start Time"; Expression = {$_.CreationTime}},
  @{Name="Stop Time"; Expression = {$_.EndTime}},
  @{Name="Total (GB)"; Expression = {[Math]::Round($_.Progress.ProcessedSize/1GB,2)}},
  Result, ID

# Gather all Backup Tasks from Sessions created within time frame
$taskList = @()
Foreach ($session in $successSessions) {
  $task = $session | Get-VBRTaskSession
  $taskList += $task
}

# Output Session Info
$successSessions | Select @{Name="Job Name"; Expression = {$_.Name}},
  @{Name="Start Time"; Expression = {$_.CreationTime}},
  @{Name="Stop Time"; Expression = {$_.EndTime}},
  @{Name="Total (GB)"; Expression = {[Math]::Round($_.Progress.ProcessedSize/1GB,2)}},
  Result, ID


Output
Code: Select all
Job Name   : Temp Backup Job (Reverse Incremental)
Start Time : 10/15/2016 2:31:08 AM
Stop Time  : 10/15/2016 2:36:01 AM
Total (GB) : 140
Result     : Success
Id         : 22d09531-431c-43f1-a916-2cefa0354a6a

Job Name   : Temp Backup Job (Reverse Incremental)
Start Time : 10/15/2016 2:31:08 AM
Stop Time  : 10/15/2016 2:36:01 AM
Total (GB) : 280
Result     : Success
Id         : 22d09531-431c-43f1-a916-2cefa0354a6a
Backerupper
Enthusiast
 
Posts: 43
Liked: 10 times
Joined: Fri Dec 28, 2012 2:32 pm

Re: Get-VBRTaskSessions changes session info?

Veeam Logoby Backerupper » Thu Oct 20, 2016 10:59 am

Any thoughts on this?
Backerupper
Enthusiast
 
Posts: 43
Liked: 10 times
Joined: Fri Dec 28, 2012 2:32 pm

Re: Get-VBRTaskSessions changes session info?

Veeam Logoby v.Eremin » Thu Oct 20, 2016 4:33 pm

Even though the described behaviour looks like a complete mystery, we've been able to confirm it. Cannot say anything about the root cause at the moment. Thanks.
v.Eremin
Veeam Software
 
Posts: 13734
Liked: 1027 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Get-VBRTaskSessions changes session info?

Veeam Logoby Backerupper » Fri Oct 28, 2016 1:56 pm

Is it safe to assume that this is found a bit late and won't be fixed in 9.5?
Backerupper
Enthusiast
 
Posts: 43
Liked: 10 times
Joined: Fri Dec 28, 2012 2:32 pm

Re: Get-VBRTaskSessions changes session info?

Veeam Logoby v.Eremin » Fri Oct 28, 2016 5:25 pm

Most likely, it won't. We are yet to find the root cause. Investigation process goes slower then usual, as all our resources are concentrated on 9.5 release. Thanks.
v.Eremin
Veeam Software
 
Posts: 13734
Liked: 1027 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Get-VBRTaskSessions changes session info?

Veeam Logoby Backerupper » Fri Oct 28, 2016 9:17 pm

Here's another example with a different trigger

This time it is tape backup sessions and the data double occurs after running GetDetails()

Yes, I realize that this may not be the supported way to get tape sessions. The problem is that Get-VBRSession returns very little helpful information.
I just found it odd that this is having the same behavior as the code above.

Code: Select all
$HourstoCheck = 16

$tapeJob = Get-VBRTapeJob -Name "CentOS Backup to Tape Job"
$tpSessions = [veeam.backup.core.cbackupsession]::GetByJob($tapeJob.id)

# Gather sessions within $HourstoCheck
$sessions = $tpSessions | ?{$_.CreationTime -ge (Get-Date).AddHours(-$HourstoCheck)}

# Output Session Info
$sessions | Select @{Name="Job Name"; Expression = {$_.Name}},
  @{Name="Start Time"; Expression = {$_.CreationTime}},
  @{Name="Stop Time"; Expression = {$_.EndTime}},
  @{Name="Total (GB)"; Expression = {[Math]::Round($_.Progress.ProcessedSize/1GB,2)}},
  Result, ID

Foreach ($session in $sessions) {
  $session.GetDetails() | Out-Null
}

# Output Session Info
$sessions | Select @{Name="Job Name"; Expression = {$_.Name}},
  @{Name="Start Time"; Expression = {$_.CreationTime}},
  @{Name="Stop Time"; Expression = {$_.EndTime}},
  @{Name="Total (GB)"; Expression = {[Math]::Round($_.Progress.ProcessedSize/1GB,2)}},
  Result, ID


Code: Select all
Job Name   : CentOS Backup to Tape Job
Start Time : 10/28/2016 6:00:09 AM
Stop Time  : 10/28/2016 6:13:41 AM
Total (GB) : 19
Result     : Success
Id         : e0cf3fa8-1091-486d-9cdb-aca99cbe276a

Job Name   : CentOS Backup to Tape Job
Start Time : 10/28/2016 6:00:09 AM
Stop Time  : 10/28/2016 6:13:41 AM
Total (GB) : 38
Result     : Success
Id         : e0cf3fa8-1091-486d-9cdb-aca99cbe276a
Backerupper
Enthusiast
 
Posts: 43
Liked: 10 times
Joined: Fri Dec 28, 2012 2:32 pm

Re: Get-VBRTaskSessions changes session info?

Veeam Logoby v.Eremin » Mon Oct 31, 2016 3:36 pm

Correct, the issue doesn't seem to be specific to particular job type. The processed data gets doubled, whenever you execute some inner method of job session object.

The causing factor is still unclear for us. Most likely, we will get back to this topic, once 9.5 is released.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13734
Liked: 1027 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Get-VBRTaskSessions changes session info?

Veeam Logoby Backerupper » Tue Sep 05, 2017 12:40 am

Any update on this?
I'm seeing it is still an issue with 9.5 Update 2
Backerupper
Enthusiast
 
Posts: 43
Liked: 10 times
Joined: Fri Dec 28, 2012 2:32 pm

Re: Get-VBRTaskSessions changes session info?

Veeam Logoby v.Eremin » Fri Sep 15, 2017 2:01 pm

While we're investigating the said behaviour, you can workaround the issue by re-assigning $sessions variable after calling internal method. Thanks.
v.Eremin
Veeam Software
 
Posts: 13734
Liked: 1027 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: thetrooper84 and 1 guest