If it is an invalid server certificate you can use this:
Set-PowerCLIConfiguration -Confirm:$false -Scope AllUsers -InvalidCertificateAction Ignore -DefaultVIServerMode Single
Set the -InvalidCertificateAction to "Ignore" and it won't give you grief. Beyond that, is there any reason that you can't go back to 6.0?
I just read your response again. You mention developing in C# but using PowerCLI. Which one is it because those are two diffierent things?? If you are dev in Powershell, my code will work, but if you are using the vCenter SDK (Vmware.vim.dll) in C#, that won't work. Let me know if you need something different.
I am in the exact same situation with C#. Any ideas how I might manage to get around this error?
1 person found this helpful
Able to work it out from some other searches....not the best way to do it perhaps, but will work for this purpose...
private void IgnoreBadCertificates()
private bool AcceptAllCertifications(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certification, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
Currently I am switching my app from 5.1 dll to 6.5 dll
How implement this solution for VimClient.Connect ?
I don't know if you are still working on this but if you call
(sender, cert, chain, sslPolicyErrors) => true;
Before VimClient.Connect() it will ignore the certificates.