This article is another part and related to this VMware PowerCLI Connect-VIServer Object reference not set to an instance of an object. The resolution used in the earlier blog is applied here in this article.
The problem description is, I connected to my vCenter server after I tried to connect ESXi server with esxcli command set but sub command elements where blank empty. I wanted to install software vib using esxcli but since sub namespace commands where not available, I was not able to perform any command. This issue is due to older version of PowerCLI version trying to connect newer version of vCenter or Esxi server.
Connect-VIServer
$esxcli = Get-VMHost | Get-EsxCli
WARNING:
The Get-EsxCli cmdlet provides a new interface to the ESXCLI functionality.
Use the -V2 parameter to switch to the new cmdlet interface.
Check the cmdlet help for more information.
Scripts that use the old cmdlet interface may no be compatible across two different versions of the ESX server.
The old cmdlet interface is deprecated and will be removed in a future version.
$esxcli
==============================
EsxCli: ironman.vcloud-lab.com
$esxcli = Get-VMHost | Get-EsxCli -V2
$esxcli
==============================
EsxCli: ironman.vcloud-lab.com
To check the current installed VMware PowerCLI version and to update module on the system use below commands. This Powershell module is downloaded and installed from online Microsoft Powershell module repository psgallery. https://www.powershellgallery.com/packages/VMware.PowerCLI/
Get-PowerCLIVersion Update-Module VMware.PowerCLI -Scope CurrentUser
After PowerCLI module upgrade is successful, I restarted PowerShell and logged into and connected to vCenter server / Esxi Server again, Checked latest version of PowerCLI, its upgraded successfully. Then tested esxcli command with PowerCLI. All the sub namespaces and element commands are listed and I can automate further esxi related tasks with them.
Connect-VIServer Get-PowerCLIVersion $esxcli = Get-VMHost | Get-EsxCli $esxcli ============================== EsxCli: ironman.vcloud-lab.com Elements: --------- daemon device esxcli fcoe graphics hardware iscsi network nvme rdma sched software storage system vm vsan
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