Sample Exchange

 View Only

PowerShell error resolution 

May 05, 2016 06:58 AM

The Resolve-Error function will show the complete information about the error, which will further help investigate the error.
#PowerShell
#VMwarePowerCLI
#PowerCLIPowerShellErrorReporting
#Apache2.0

Statistics
0 Favorited
0 Views
1 Files
0 Shares
0 Downloads
Attachment(s)
ps1 file
PowerShell-error-resolution.ps1   342 B   1 version
Uploaded - Apr 09, 2024

Tags and Keywords

Comments

Jun 24, 2016 01:35 AM

Kindly help me on this as soon as possible as I need to share the resolution with customer.

Jun 24, 2016 01:33 AM

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
Regards,
Chetan

Related Entries and Links

No Related Resource entered.