Hi Team, I have another query where one of my customer see the issue in fetching the virtual switch details using a powerCLI cmdlet "Get-VirtualSwitch". Customer always see the "Error : Object reference not set to an instance of an object." Customer is using VMware vSphere PowerCLI 6.3 Release 1 build 3737840 We tried reproducing the same issue in-house but we were unable to get this error message and seen the correct output.
The cmdlet is very starlight forward but the issue is only seen in customer environment only. Please see the below :
Example of how PowerCLI Get-VirtualSwitch consistently fails…
[DBG]: PS >> $theConnect
Name Port User ---- ---- ---- crbc000e... 443 bogus\mickey
[DBG]: PS >> $theDatacenter
Name ---- LTT-Concord
[DBG]: PS >> $Name
vDistributedSwitch
And yes, the virtual switch does exist in vCenter, but when I try to call Get-VirtualSwitch...
[DBG]: PS D:\APS\Provision>> Get-VirtualSwitch -Name $Name -Server $theConnect -Datacenter $theDataCenter Get-VirtualSwitch : 5/25/2016 8:59:54 AM Get-VirtualSwitch Object reference not set to an instance of an object. At line:1 char:1 + Get-VirtualSwitch -Name $Name -Server $theConnect -Datacenter $theDataCenter + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-VirtualSwitch], VimException + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetVirtualSwitch
Get-VirtualSwitch : 5/25/2016 8:59:54 AM Get-VirtualSwitch VirtualSwitch with name 'vDistributedSwitch' was not found using the specified filter(s). At line:1 char:1 + Get-VirtualSwitch -Name $Name -Server $theConnect -Datacenter $theDataCenter + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (:) [Get-VirtualSwitch], VimException + FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetVirtualSwitch
I have another query where one of my customer see the issue in fetching the virtual switch details using a powerCLI cmdlet "Get-VirtualSwitch". Customer always see the "Error : Object reference not set to an instance of an object."
Customer is using VMware vSphere PowerCLI 6.3 Release 1 build 3737840
We tried reproducing the same issue in-house but we were unable to get this error message and seen the correct output.
The cmdlet is very starlight forward but the issue is only seen in customer environment only. Please see the below :
Example of how PowerCLI Get-VirtualSwitch consistently fails…
[DBG]: PS >> $theConnect
Name Port User
---- ---- ----
crbc000e... 443 bogus\mickey
[DBG]: PS >> $theDatacenter
Name
----
LTT-Concord
[DBG]: PS >> $Name
vDistributedSwitch
And yes, the virtual switch does exist in vCenter, but when I try to call Get-VirtualSwitch...
[DBG]: PS D:\APS\Provision>> Get-VirtualSwitch -Name $Name -Server $theConnect -Datacenter $theDataCenter
Get-VirtualSwitch : 5/25/2016 8:59:54 AM Get-VirtualSwitch Object reference not set to an instance of an object.
At line:1 char:1
+ Get-VirtualSwitch -Name $Name -Server $theConnect -Datacenter $theDataCenter
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-VirtualSwitch], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetVirtualSwitch
Get-VirtualSwitch : 5/25/2016 8:59:54 AM Get-VirtualSwitch VirtualSwitch with name 'vDistributedSwitch' was not found using the specified filter(s).
At line:1 char:1
+ Get-VirtualSwitch -Name $Name -Server $theConnect -Datacenter $theDataCenter
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Get-VirtualSwitch], VimException
+ FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetVirtualSwitch
Regards,
Chetan