We are suffering from a script slowness due to too much data coming out of the Get-VBRBackupSession command. We have a big Veeam B&R with a LOT of jobs and we need to slim down the processing of the following script below, or accelerate it's processing somehow. The usual suspects have been accounted for (Veeam B&R server has a lot of available resources, All-Flash storage, SQL Standard instead of express etc).
Currently, this script takes over a minute to execute, which is unacceptable for our scenario:
Code: Select all
foreach ($i in (Get-VBRBackupSession | ?{ $_.JobId -eq "JOBID" } | Sort-Object CreationTime -Descending | select -First 25))
{
foreach ($j in (Get-VBRTaskSession $i))
{
$sessionProps = @{
Name = $j.Name
Id = $j.Id
SessionId = $i.Id
SessionCreationTime = $i.CreationTime
SessionResult = $i.Result.ToString()
Status = $j.Status.ToString()
JobName = $j.JobName
VirtualMachine = $j.Info.ObjectName
Reason = $j.Info.Reason
QueuedTime = $j.Info.QueuedTime
}
New-Object PSObject -Property $sessionProps
}
}
Any ideas? We will probably open a ticket today for this issue.