Power CLI Error: Invalid server certificate. Use Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option

Power CLI Error: Invalid server certificate. Use Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option

This is just a very common error when you trying to access the vCenter Server with PowerCLI and when you have an invalid server certificate, probably the first time you are trying to connect with PowerCLI. You can easily fix it by executing a line of command. I hope this will be really useful.

Connect-VIServer Connect-VIServer : 2/20/2019 6:27:50 AM 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 ‘VCENTER_SERVER’. At line:1 char:1 + Connect-VIServer <VCENTER_IP_ADDRESS_FQDN> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [Connect-VIServer], ViSecurityNegotiationException + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_CertificateError,VMware.VimAutomation.ViCore. Cmdlets.Commands.ConnectVIServer

Invalid Server Certificate

Just execute below command to ignore the invalid certificate

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

I hope it helps.

Click to rate this post!
[Total: 22 Average: 4.7]

5 responses

  1. Tom Avatar
    Tom

    The solution does work if you connect to vCenter server once per PowerShell session. If you connect to the same vCenter again, it will fail with the same error message. So all scripts that use multiple connections to the same vCenter don’t work anymore and I have to open a new PowerShell session for every script I want to run. Worked fine with PowerCLI 6.5R1. The issue came with PowerCLI 10 and persists with version 11. I probably need to open a SR.

    1. Aruna Lakmal Avatar

      Thanks Tom for your valuable feedback!

  2. Vivek Joseph Avatar
    Vivek Joseph

    It helped, thanks a lot sir!!

    1. Aruna Lakmal Avatar

      Thanks for the comment Vivek!

  3. Hotshot Avatar
    Hotshot

    Thanks a lot. It worked.

Leave a Reply

Your email address will not be published. Required fields are marked *