Automation

 View Only
  • 1.  Using the get-inventoryplus function getting error....

    Posted May 17, 2019 09:50 PM

    vCenter Appliance version: 6.5 11347054

    PowerCLI version:

    VMware.Vim 6.7.0.10334489

    VMware.VimAutomation.Cis.Core 11.0.0.10335701

    VMware.VimAutomation.Common 11.0.0.10334497

    VMware.VimAutomation.Core 11.0.0.10336080

    VMware.VimAutomation.Sdk 11.0.0.10334495

    I've been using the below function...

    Get-InventoryPlus - Inventory of all vSphere objects - LucD notes

    Haven't used it in a few months but now I am getting the below bunch of errors...

    Cannot convert the "System.Object[]" value of type "System.Object[]" to type "VMware.Vim.ManagedEntity".

    At line:125 char:11

    +           $Object = Get-View -Id $Parent -Property Name,Parent

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

        + CategoryInfo          : InvalidArgument: (:) [], RuntimeException

        + FullyQualifiedErrorId : ConvertToFinalInvalidCastException

    Cannot convert the "System.Object[]" value of type "System.Object[]" to type "VMware.Vim.ManagedEntity".

    At line:125 char:11

    +           $Object = Get-View -Id $Parent -Property Name,Parent

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

        + CategoryInfo          : InvalidArgument: (:) [], RuntimeException

        + FullyQualifiedErrorId : ConvertToFinalInvalidCastException

    The errors go on and on.

    Any ideas on how to fix?



  • 2.  RE: Using the get-inventoryplus function getting error....

    Posted May 17, 2019 09:51 PM

    Are you perhaps connected to more than one vSphere server?

    What is in $global:defaultVIServers?



  • 3.  RE: Using the get-inventoryplus function getting error....

    Posted May 17, 2019 10:31 PM

    When I connected to the old vcenter server I thought I was connected to only one. Turned out I was connected to two. I removed one and it's running now.

    This explains why in the new set of vCenter servers this is happening because the vcenter servers are in linked mode.

    How can I get this to work with linked mode vcenter servers other than connecting individually?

    Thanks



  • 4.  RE: Using the get-inventoryplus function getting error....

    Posted May 18, 2019 04:58 AM

    Did you try by using the Server parameter?
    You could do for example

    Get-InventoryPlus -Server $global:DefaultVIServers[0]