Search code examples
powershellexchange-serverpowershell-2.0powershell-remoting

Error connecting to exchange server remotely via PowerShell


I am trying to connect to my Exchange server remotely using PowerShell. The Exchange server is on its own dedicated Exchange forest. I am trying to open the connection on a forest that does not have the Exchange server.

This is what I have in my PowerShell script:

$powershell_url = "http://exhange_server_url.com/PowerShell/"
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $powershell_url -Authentication Kerberos

When I run this script, I get this error:

[exhange_server_url.com] Connecting to remote server failed with the following error message : The WinRM client cannot process the request. The authentication mechanism requested by the client is not supported by the server or unencrypted traffic is disabled in the service configuration. Verify the unencrypted traffic setting in the service configuration or specify one of the authentication mechanisms supported by the server. To use Kerberos, sp ecify the computer name as the remote destination. Also verify that the client computer and the destination computer ar e joined to a domain. To use Basic, specify the computer name as the remote destination, specify Basic authentication a nd provide user name and password. Possible authentication mechanisms reported by server: For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc eption + FullyQualifiedErrorId : PSSessionOpenFailed

How do I resolve this issue?


Solution

  • This is what I ended up doing:

    $credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist "DOMAIN\Administrator","password"
    #connect with remote cas server
    $powershell_url = "http://cas-server/PowerShell/"
    $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $powershell_url  -credential $credentials -Authentication Kerberos