PowerShell script exchange
Post Reply
stsc_srzc
Influencer
Posts: 23
Liked: 2 times
Joined: Feb 21, 2013 11:53 am
Contact:

Sequence contains no elements on Find-VBRViEntity call

Post by stsc_srzc »

Hi Veeam Team!

We are looking for some help on the "Find-VBRViEntity" PowerShell command.
We use this to query all servers registred for each virtual center.
I have created the following example script to demonstrate the problem.

We are seeing this on some servers with Veeam 9.5.0.1038 but only sometimes.

Our questions on this:
* can someone reproduce this or already know this issue
* on what is the message "Sequence contains no elements" referring? All variables used in the call are filled

Any help is appreciated



Example script

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn #-ErrorAction SilentlyContinue
$VCs = Get-VBRServer -Type VC
foreach ($vc in $VCs){
    write-host "vc" $vc.Name
    write-host "type" $vc.Type
    $servers = Find-VBRViEntity -Server $vc -Servers

    foreach ($server in $servers) {
write-host $server.name
}
}

Error message

Code: Select all

Find-VBRViEntity : Sequence contains no elements
At C:\Users\Administrator\Desktop\test\forum-list-esx.ps1:5 char:53
+         $servers = Find-VBRViEntity -Server $vc  -Servers 
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Find-VBRViEntity], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Veeam.Backup.PowerShell.Cmdlets.FindVBRViEntity

Best wishes
Stefan
Andreas Neufert
VP, Product Management
Posts: 6748
Liked: 1408 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Sequence contains no elements on Find-VBRViEntity call

Post by Andreas Neufert »

-server need to be a single object not an array
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Sequence contains no elements on Find-VBRViEntity call

Post by veremin »

1) Remove -Servers parameter from this line: $servers = Find-VBRViEntity -Server $vc -Servers
2) For testing purpose use single VC (instead querying bunch of those within cycle) and see whether Find-VBRViEntity returns at least something
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests