Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

VMware PowerCLI Connect-VIServer Object reference not set to an instance of an object

While connecting to ESXi Server with VMware PowerCLI from one of my server I was keep receiving below error. I wasn't able to connect to ESXi server directly from PowerCLI module. 

@SERVER01 ~ Connect-VIServer ironman.vcloud-lab.com
Connect-VIServer :  Object reference not set to an instance of an object.
At line:1 char:1
+ Connect-VIServer ironman.vcloud-lab.com
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo           : NotSpecified: (:) [Connect-VIServer], NullReferenceException
    + FullyQualifiedErrorId  : System.NullReferenceException,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer

After trying few troubleshooting options I came to know, this issue occurs due to old version of the VMware PowerCLI I was using, possibly due to bugs in older version, I went to the Powershell Gallary (psgallery) website and checked the latest version. I found I was running way back older version of PowerCLI.

https://www.powershellgallery.com/packages/VMware.PowerCLI/

From commands, I can check the current version of installed VMware.PowerCLI module. Next I can find latest PowerCLI module available online. Module can be easily updated with Update-Module.

@SERVER01 ~ Get-PowerCLIVersion
@SERVER01 ~ Find-Module VMware.PowerCLI
@SERVER01 ~ Update-Module VMware.PowerCLI -Scope CurrentUser

Once Module is downloaded and uploaded locally successfully from PSGallery repository, Checked the command again to verify the PowerCLI version. Alternatively to check latest version Get-Module -List command can also be used. In the last verify if I am able to connect to ESXi server.

@SERVER01 ~ Get-PowerCLIVersion
@SERVER01 ~ Connect-VIServer ironman.vcloud-lab.com

Useful Articles
Resolved: HP ILO this page cannot be displayed ERR_SSL_BAD_RECORD_MAC_ALERT
Reset/Restart HP ILO (Integrated Lights-outs) using putty
Reset HP ILO password from Esxi server
ESXi HP Blade start issue Enclosure power event detected, System Halted until power condition is corrected
Esxi update individual component firmware on HP hardware: disk degraded not authenticated
Resolved syslog error: Call OptionManager.UpdateValues for object ha-adv-options on ESXi failed
Solved: Esxi server cannot joined into active directory domain
Solved Esxi host disconnected evaluation license expired
Connect-VIServer Error: Invalid server certificate. Use Set-PowerCLIConfiguration



This post first appeared on Tales From Real IT System Administrators World And Non-production Environment, please read the originial post: here

Share the post

VMware PowerCLI Connect-VIServer Object reference not set to an instance of an object

×

Subscribe to Tales From Real It System Administrators World And Non-production Environment

Get updates delivered right to your inbox!

Thank you for your subscription

×