Hi,
Just updating as it worked in my case and can help someone else as well.
The certificate was not that great in my case, even if it was trusted by my client PC and OWA on SSL was just fine.
Changing the connection URI from HTTPS to HTTP worked.
-ConnectionUri http://exch1.contoso.com
"The HTTP error occurs because of the URL not being correct (see => pcsupport.about.com/od/findbyerrormessage/a/400error.htm ) you can try to lower the security and try to connect it without secure sockets (HTTP instead of HTTPS) and see if it works
(just an idea) or try to see if the IP adress is correct."
Code I was running:
$cred = Get-Credential
$sessionoption = New-PSSessionOption -SkipCNCheck
$exchangesession = New-PSSession -Credential $cred -ConnectionUri http://exch1.contoso.com/PowerShell -ConfigurationName Microsoft.Exchange -AllowRedirection -SessionOption $sessionoption
Import-PSSession $exchangesession
Get-Mailbox user1 | select exchangeVersion
Get-Mailbox user2 | select prohibitsendquota
Set-MailboxautoReplyConfiguration user1 -starttime 06/06/2015 -Endtime 07/06/2015 -AutoReplyState Scheduled -InternalMessage ="test" -ExternalMessage "test"
get-exchangeserver
Error:
New-PSSession : [exch1.contoso.com] Connecting to remote server exch1.contoso.com failed with the following error
message : The WinRM client received an HTTP bad request status (400), but the remote service did not include any
other information about the cause of the failure. For more information, see the about_Remote_Troubleshooting Help
topic.
At line:1 char:20
+ $exchangesession = New-PSSession -Credential $cred -ConnectionUri https://exch1. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemot
ingTransportException
+ FullyQualifiedErrorId : -2144108175,PSSessionOpenFailed
References:
Remote connection to an exchange Powershell hosted on IIS