Ignore SSL errors in VMware PowerCLI

vmware-logo.jpg

I have a few weeks left on a couple of the dedicated servers I’m no longer using, so I figured it would be a good opportunity to refresh my VMware skills and perhaps learn something new with ESXi 6.5 (one of the best free hypervisors available, fully using hardware virtualization).

Turns out, you can install and use VMware PowerCLI on MacOS, pretty cool! As a pre-requisite, you need to install Windows PowerShell using Homebrew first. All the commands below are the PowerShell ones (you start it by typing pwsh).

SSL connection errors in VMware PowerCLI

Because it’s a freshly installed ESXi instance with a self-signed SSL certificate, it will through a warning when connecting to the server using browser or using VMware PowerCLI:

PS /Users/greys> Connect-VIServer -Server 62.210.x.y                                                           

Specify Credential
Please specify server credential
User: root
Password for user root: *********

Connect-VIServer : 12/02/2019 23:43:52 Connect-VIServer The SSL connection could not be established, see inner exception.
At line:1 char:1
+ Connect-VIServer -Server 62.210.x.y
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Connect-VIServer], ViError
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_SoapException,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
This is because by default PowerCLI doesn’t have a defined approach to invalid SSL certificates.
You can confirm it with the Get-PowerCLIConfiguration command:
Screen Shot 2019-02-13 at 08.01.21.png

Ignore Invalid SSL Certificates in VMware PowerCLI

Let’s update tihe InvalidCertificateAction setting to “Ignore”:

Screen Shot 2019-02-13 at 08.01.33.png

And now our connection should work just fine:

PS /Users/greys> Connect-VIServer -Server 62.210.x.y

Specify Credential
Please specify server credential
User: root
Password for user root: *********

Name Port User
---- ---- ----
62.210.x.y 443 root

PS /Users/greys>
That’s it! Will publish more as I learn, so stay tuned!

See Also