11 Replies Latest reply on Oct 8, 2018 9:08 AM by vijayrana968

    Get-View -RelatedObject returns error Unable to retrieve related object: vCenter server

    dmveron2 Novice

      Hello,

      I'm having a very strange issue with a bit of code that grabs information on VMs in out vCloud environment. This segment feeds in the names of the Org vDC, a vApp within that Org vDC, and a VM within that vApp in order to return the full name of the VM in vCenter, which is usually the vCloud VM name followed by the cloud.uuid. This is the code in question:

      $getCIVMinfo = Get-OrgVdc $CurrentOrgvDC | Get-CIVApp -Name $currentCIVApp | Get-CIVM -Name $currentCIVM

      $vsphereVMView = Get-View –RelatedObject $getCIVMinfo.ExtensionData

       

      In four of our five vCenters, this works without issue. However, in the fifth vCenter, the second line returns this error:

      $vsphereVMView = Get-View -RelatedObject $getCIVMinfo.ExtensionData

      Get-View : 08-Oct-18 08:48:00   Get-View                Unable to retrieve related object: vCenter server

      'https://fqdn-of-vcenter-redacted:443' could not be found. Please make sure you are connected..

      At line:1 char:18

      + $vsphereVMView = Get-View -RelatedObject $getCIVMinfo.ExtensionData

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

          + CategoryInfo          : ObjectNotFound: (VMware.VimAutomation.Cloud.Views.Vm:Vm) [Get-View], VimException

          + FullyQualifiedErrorId : Core_GetView_RelatedObject_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetIn

         terop.GetVIView

       

      I'm definitely connected to the vCenter, and I can run other cmdlets against it without issue. I've also tried connecting to this vCenter by IP rather than FQDN to see if that would make a difference, but I still get the same error. I also had a colleague try from his computer to make sure it wasn't just me, but he ran into the same issue. All five vCenters are on the current version of 6.5 and we're both running the current PowerCLI modules. The only difference between this vCenter and the rest is that this one is on a Windows VM whereas the other four are VCSAs - but I don't see why that would matter.

       

      Thanks in advance.