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.
Have you tried telnet 443 to vCenter from workstation where you are trying to run this from !
I get a blinking cursor for about 30 seconds before it times out and returns to the command prompt - which is the same response from the other four vCenters.
Which PowerCLI version are you using?
And does this give the same error?
Get-VM -RelatedObject $getCIVMinfo
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello LucD,
Running the command as you suggested results in the same error, but just Get-VM $getCIVMinfo* by itself works fine. I've pasted the results of some attempts below. And here's the version info:
Get-Module -Name VMware.PowerCLI | Select-Object -Property Name,Version
Name Version
---- -------
VMware.PowerCLI 10.2.0.9372002
PS C:\ps> $getCIVMinfo = Get-OrgVdc NameRedacted | Get-CIVApp -Name Collector-02 | Get-CIVM -Name Collector02
PS C:\ps> $vsphereVMView = Get-VM -RelatedObject $getCIVMinfo
Get-VM : 08-Oct-18 09:58:11 Get-VM vCenter server 'https://fqdnredacted:443' could not be
found. Please make sure you are connected.
At line:1 char:18
+ $vsphereVMView = Get-VM -RelatedObject $getCIVMinfo
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-VM], CIException
+ FullyQualifiedErrorId : CloudImpl_VIObjectInteropServiceImpl_GetDatastore_Error,VMware.VimAutomation.ViCore.Cmdl
ets.Commands.GetVM
PS C:\ps> get-vm Collector02*
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
COLLECTOR02 (... PoweredOn 2 4.000
PS C:\ps> Get-VM -RelatedObject $getCIVMinfo
Get-VM : 08-Oct-18 09:59:34 Get-VM vCenter server 'https://fqdnredacted:443' could not be
found. Please make sure you are connected.
At line:1 char:1
+ Get-VM -RelatedObject $getCIVMinfo
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-VM], CIException
+ FullyQualifiedErrorId : CloudImpl_VIObjectInteropServiceImpl_GetDatastore_Error,VMware.VimAutomation.ViCore.Cmdl
ets.Commands.GetVM
PS C:\ps> $getCIVMinfo
Name Status GuestOSFullName CpuCount MemoryGB
---- ------ --------------- -------- --------
COLLECTOR02 PoweredOn Microsoft Windows Server 2012 (64-bit) 2 4.000
PS C:\ps> Get-VM $getCIVMinfo*
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
COLLECTOR02 (... PoweredOn 2 4.000
Sorry, I don't know how to paste with the PowerShell colors in-tact. Thanks in advance.
That's the latest PowerCLI version.
The fact the vCenter is a Windows-version could play a role.
Did you already try disabling the Firewall on the Windows box?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I just RDPed into the Windows box to check, and we have the windows firewall completely disabled. Good thought though.
There are 2 options left:
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
"network trace with the cmdlet" do you mean tracert to the vCenter? Thanks.
No, a real network trace with something like WireShark for example.
But it requires some network protocol knowledge.
If too tricky, I would go for the SR
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ah, got it.
I think I'm going to head down the SR route and see where that goes. I did some manual testing on different machines, including logging in with a local account to a Windows VM on the same subnet as the vCenter I'm having issues with. PowerCLI had never been installed on this box. I installed power CLI, connected to vCenter using the IP, and I'm still receiving the same error. Interestingly enough, the error includes the FQDN even though I connected by IP. I'll update this thread with anything I get from support in case someone else out there runs into this issue. Thanks!
When youre executing command, run netstat -a -n on workstation and see the connection statistics for impacted and other vCenter.