How to fix Connect-VIServer “Error: Invalid server certificate”

If you see following error when trying to connect to host useing Connect-VIServer:

Connect-VIServer : 6/14/2021 3:16:08 PM Connect-VIServer Error: Invalid server certificate. Use Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option to Prompt
if you’d like to connect once or to add a permanent exception for this server.
Additional Information: Could not establish trust relationship for the SSL/TLS secure channel with authority ‘xx.xx.xx.xx’.
At line:1 char:1

  • Connect-VIServer
  • ~~~~~~~
    • CategoryInfo : SecurityError: (:) [Connect-VIServer], ViSecurityNegotiationException
    • FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_CertificateError,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer

Just run following powershell command:

Set-PowerCLIConfiguration InvalidCertificateAction=Prompt

Leave a Reply