PowerCLI

 View Only
  • 1.  Sequence contains more than one matching element

    Posted Dec 05, 2019 08:12 PM

    Scratching my head on this one. There's 5 vCenters I access on a regular basis and on one of them I started getting this following.

    get-cluster

    get-cluster : 12/5/2019 3:00:59 PM      Get-Cluster             Sequence contains more than one matching element       

    At line:1 char:1

    + get-cluster

    + ~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-Cluster], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetCluster

    Same error for commands like get-vmhost and quite a few others. Commands like get-vm work fine but anything hosts,cluster,datastore fail.

    Ideas?



  • 2.  RE: Sequence contains more than one matching element

    Posted Dec 05, 2019 08:42 PM

    Did you already try stop/start of your PS session?



  • 3.  RE: Sequence contains more than one matching element

    Posted Dec 06, 2019 01:51 AM

    Yes, sir. This isn't happening just for me either on this single vCenter. Based on other searches I looked for any duplicate entries or oddness. get-vm works but any commands against hosts and clusters appear to fail.

    get-vmhost

    get-vmhost : 12/5/2019 8:55:28 PM       Get-VMHost              Sequence contains more than one matching element      

    At line:1 char:1

    + get-vmhost

    + ~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-VMHost], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVMHost

    I did see some mentions you made in regards to a issue tag assignments a few years ago that was getting the same error and that ended up being a bug due to disconnected or "mangled" VM names.

    A few months back we did perform a cluster rename but I'm pretty sure I've run successful vChecks since then. I was attempting to run your orphan file script on this vCenter when I started having these error returns. I'm not implying your script did anything, I use it all the time. It just brought these problems to my attention.

    BTW you are awesome. Big fanboi



  • 4.  RE: Sequence contains more than one matching element

    Posted Dec 06, 2019 06:51 AM

    Thanks.

    Which PowerCLI version and which vSphere version are you using?

    Do you get correct results when using Get-View cmdlet and retrieve vSphere objects.

    For example with

    Get-View -ViewType HostSystem | Select Name

    Get-View -ViewType VirtualMachine | Select Name



  • 5.  RE: Sequence contains more than one matching element

    Posted Dec 06, 2019 03:28 PM

    Get-View -ViewType HostSystem | Select Name

    • Returns a list of all the hosts on the vCenter

    Get-View -ViewType VirtualMachine | Select Name

    • Returns a list of all the virtual machines on the vCenter

    Versions:

    • powercli version :  VMware PowerCLI 11.5.0 build 14912921
    • powershell version: PSVersion 6.2.3


  • 6.  RE: Sequence contains more than one matching element

    Posted Dec 06, 2019 03:46 PM

    Ok, that seems to indicate it is a PowerCLI issue.
    Do you bij any chance have a station (Windows OS) with PSv5.* somewhere to try the same?



  • 7.  RE: Sequence contains more than one matching element

    Posted Dec 06, 2019 05:56 PM

    Versions:

    Powershell: 5.1.15063.1805

    PowerCLI: 11.5.0 build 14912921

    (side note: I upgrade the powercli version on this machine after I started running into this. I don't recall what version was previously installed)

    Get-View -ViewType HostSystem | Select Name

    • Returns a list of all the hosts on the vCenter

    Get-View -ViewType VirtualMachine | Select Name

    • Returns a list of all the virtual machines on the vCenter

    get-vmhost and get-cluster returns the same sequence error.

    When I run :

    get-vmhost -name XXXXXXXX

    The return is:

    Get-VMHost Sequence contains more than one matching element

    but also includes:

    get-vmhost : 12/6/2019 12:51:16 PM Get-VMHost VMHost with name 'XXXXXXXXXXXXXX' was not found using the specified filter(s).

    Also, both the machine with powershell 5 and powershell 6 only get this issues on one vCenter. With the other four vCenters there are no problems running these commands.



  • 8.  RE: Sequence contains more than one matching element

    Posted Dec 06, 2019 10:18 PM

    Is that a vCenter that you renamed or changed the IP?

    In any case, I would suggest to open a SR