C# RS connecting to specific exchange configuration


Im trying to figure out how to specify a given Configuration when connecting to a remote server. My task is to do some exchange (2013) queries, and from PS i can do a remote command like this and it works perfectly.

Invoke-Command -ConnectionUri https://servername.com/PowerShell -Credential $user -ScriptBlock {Get-Mailbox somename} -ConfigurationName Microsoft.Exchange

But when trying to access the it thrugh c# it fails:

[i] WSManConnectionInfo connectionInfo = new WSManConnectionInfo[
new Uri[http://servername.com/PowerShell],

        connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;

        Runspace runspace = RunspaceFactory.CreateRunspace[connectionInfo];


It comes around saying:

Unhandled Exception: System.Management.Automation.Remoting.PSRemotingTransportEx
ception: Connecting to remote server servername.com failed wi
th the following error message : The WinRM service received a HTTP redirect mess
age redirecting the client but the location URL is invalid. For more information
, see the about_Remote_Troubleshooting Help topic.
at MyApi.GetUser(String azIdent)
at MyApi.ConsoleTest.Program.Main(String args)

im a bit puzzled… what IS that?
I do not have access to the server-side.

Hope someone can help me out here…

kind regards Jesper

Hopefully I’m not pointing out the obvious, but in the Uri in the PS command you used https:// while in the C# example you used http://. It’s possible the server is not accepting requests on port 80.