AsBuiltReport.Veeam.VBR icon indicating copy to clipboard operation
AsBuiltReport.Veeam.VBR copied to clipboard

Report hangs if there are offline object in the Veeam Inventory

Open rebelinux opened this issue 1 year ago • 1 comments

Bug description

When using the Find-VBRViEntity cmdlet there are times where the report hangs for a long time if there are offline objects in the vSphere or HyperV inventory.

Command-line input

$Datastores = Find-VBRViEntity -DatastoresAndVMs -ErrorAction SilentlyContinue | Where-Object {($_.type -eq "Datastore")}

Steps to reproduce

.1 Run the report on a site with offline entity in the inventory

Expected behaviour

Find a way to set a timeout for the cmdlet. This will prevent the report from hanging for a long time.

Screenshots

No response

Operating System

Windows OS

PowerShell Version

Name                           Value
----                           -----
PSVersion                      5.1.19041.3693
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.3693
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PowerShell Modules

Name                    Version
----                    -------
AsBuiltReport.Veeam.VBR 0.8.4
AsBuiltReport.Core      1.3.0
PScribo                 0.10.0

Additional Context

No response

Before submitting

rebelinux avatar Jan 16 '24 16:01 rebelinux

$Timeout = 60
$job = Start-Job -ScriptBlock {
    # Here's where you put the stuff that might hang or take too long.
}

$JobTimer = 0

# Wait for the number of seconds in the $Timeout variable before giving up on the job.
while ($job.State -eq "Running" -and $JobTimer -le $Timeout) {
    $JobTimer = $JobTimer + 1
    sleep -Seconds 1
}

if ($job.State -eq "Completed" -and $job.HasMoreData -eq $true) {
    $job | Receive-Job
}

rebelinux avatar Jan 16 '24 16:01 rebelinux

Unable to provide a solutions for this issue.

rebelinux avatar Jul 20 '24 12:07 rebelinux