When trying to connect with PowerCLI to a vCenter Server Appliance the following error occurred:
Connect-vIServer : 18-7-2018 13:20:10 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.
As stated in the error, the Set-PowerCLIConfiguration command can be used to ignore the certificate check using the following syntax:
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
After this command you’re able to connect to the vCenter without the certificate error.
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.
Can you please help me how to no prompt form below powercli command
Set-PowerCLIConfiguration -ProxyPolicy NoProxy:$false
its asking Y A N C options .. I want to make it default Y
@Vijay :
You may use –
Set-PowerCLIConfiguration -ProxyPolicy NoProxy -Confirm:$false
helped a lot. was trying as -Confirm $false. thanks for this document
Or – you could install the necessary root CA certificate which you can download from the vCentre web page – see https://kb.vmware.com/s/article/2108294
I just found this page and I used the -Force option on Connect-VIServer
Worked right away and is permanent in my script.