title: how to ignore SSL certificate is signed by an unknown certificate authority problem?
body: <p>I'm developing c# application to call Exchange Management Shell Cmdlets. It always comes out with an exception of "The server certificate on the destination computer (208.243.XX.2XX:443) has the following errors:<br>
  The SSL certificate is signed by an unknown certificate authority.<br>
  The SSL certificate contains a common name (CN) that does not match the hostname. "</p>
  
  <p>But I did write code to accept all certificate, don't know why still get the error.</p>
  
  <p>My code:</p>
  
  <pre><code>    PSCredential credential = new PSCredential("administrator", securePwd);
  
      WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("https://208.243.49.20/powershell"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential);
      connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;
  
      Runspace runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(connectionInfo);
      PowerShell powershell = PowerShell.Create();
      PSCommand command = new PSCommand();
      command.AddCommand("New-Mailbox");
      command.AddParameter("Name", "TestName");
      powershell.Commands = command;
      ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(
      delegate { return true; }
  );
      try
      {
          runspace.Open();//This is where the exception happens
          powershell.Runspace = runspace;
          Collection&lt;PSObject&gt; result= powershell.Invoke();
      }
  </code></pre>