PowerShell script exchange
Post Reply
dbr
Expert
Posts: 121
Liked: 16 times
Joined: Apr 06, 2017 9:48 am
Full Name: Daniel Brase
Contact:

Method GetTaskSessions() not working as expected

Post by dbr »

Hi all,

I want to collect some session data. Besides other information I want to get the number of processed vms via method, e.g.:

Code: Select all

($session.gettasksessions()).count
After executing the method the progress data has changed ($session.info.progress). In Example $session.info.progress.avgspeed has changed from 77804339 to 581416 and $session.info.progress.totalsize doubled from 78383153152 to 156766306304.

My script to reproduce the problem:

Code: Select all

# get some sessions with data
$sessions = Get-VBRBackupSession | where {$_.endtime -ne "01.01.1900 00:00:00" -and $_.jobname-eq "se-bu-52" -and $_.info.progress.avgspeed -ne 0 -and $_.result -eq "success"}
# write one single object in a variable
$session = $sessions[0]
# output progress data
$session.info.progress
# execute gettasksessions method
$session.gettasksessions()
# output progress data and compare
$session.info.progress
In addition following code doesn't write the session info in the variable but only display the selection session on powershell console.

Code: Select all

$session = Get-VBRBackupSession | select -first 1
Can anyone confirm both issues and maybe can explain what's going on here?

Thanks,
Daniel
dbr
Expert
Posts: 121
Liked: 16 times
Joined: Apr 06, 2017 9:48 am
Full Name: Daniel Brase
Contact:

Re: Method GetTaskSessions() not working as expected

Post by dbr »

We're running Veeam Backup & Replication 9.5 Update 4b...
christophe.niel.AID
Service Provider
Posts: 11
Liked: never
Joined: Jul 25, 2019 1:11 pm
Full Name: Christophe Niel
Contact:

Re: Method GetTaskSessions() not working as expected

Post by christophe.niel.AID »

For the easy one, instead of

Code: Select all

  $session = Get-VBRBackupSession | select -first 1
try this

Code: Select all

 $session = (Get-VBRBackupSession)[0]
Does work more quickly, but yeah it's a bug somewhere in the piping of the "GET-VBR*" command, I can confirm it fails also for Get-VBRJob
if you do it like on the web help : "Get-VBRBackupSession | Sort EndTimeUTC -Descending | Select -First 1" it does work, probably because the object type is handled in a better way when the full list is loaded, as induced by the sort... well, ()[0] is fine but not error proof.

then I can confirm your issue : here is before using gettasksessions()

Code: Select all

TotalObjects             : 1
ProcessedObjects         : 1
ProcessedSize            : 279172874240
ProcessedUsedSize        : 115393691647
ReadSize                 : 3133145088
ReadedAverageSize        : 3133145088
TransferedSize           : 3064949396
ProcessedDelta           : 0
ProcessedUsedDelta       : 0
ReadDelta                : 0
ReadedAverageDelta       : 0
TransferedDelta          : 0
StartTimeLocal           : 7/24/2019 11:30:20 PM
StopTimeLocal            : 7/25/2019 4:53:34 AM
StartTimeUtc             : 7/24/2019 9:30:20 PM
StopTimeUtc              : 7/25/2019 2:53:34 AM
Percents                 : 100
AvgSpeed                 : 23335044
BottleneckInfo           : Veeam.Backup.Model.CBottleneckInfo
TotalSize                : 279172874240
TotalUsedSize            : 115393691647
UsedSpaceRation          : 0.413341346150264
TotalSizeDelta           : 0
TotalUsedSizeDelta       : 0
Duration                 : 05:23:14.2300000
Updates                  : Veeam.Backup.Model.CBackupProgressUpdates
IsNeedSubstractReadDelay : False
after (I kept only the modified values)

Code: Select all

ProcessedSize            : 558345748480
ProcessedUsedSize        : 230787383294
TransferedSize           : 6129898792
ProcessedDelta           : 279172874240
ProcessedUsedDelta       : 115393691647
TransferedDelta          : 3064949396
Percents                 : 100
AvgSpeed                 : 238722
UsedSpaceRation          : 0.413341346150264
TotalSizeDelta           : 279172874240
TotalUsedSizeDelta       : 115393691647

then I used the "correct way" to get task session on another session

Code: Select all

  $session | get-vbrtasksession
(this output exactly what $session.gettasksession() does, same content, same objecttype)

and the session.info is not modified.

there are bugs for sure, but using objects piping is cleaner I think
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Method GetTaskSessions() not working as expected

Post by veremin »

Christophe has described a correct way of getting task sessions. Using Get-VBRTaskSession cmdlet should not result in any parameter modification, so, feel free to use. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests