I've just encountered a curious issue in my attempts to connect to a remote Exchange server. I spent a long time unable to establish a session and tried a variety of things until I tried changing the format of the username.
The code I'm running is as follows:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<SERVER>.com/PowerShell/ -Authentication Kerberos -Credential $username
If I set $username to "DOMAIN\username", it returns the following error:
New-PSSession : [<SERVER>.com] Connecting to remote server azuks-
mgt01.wagamama.com failed with the following error message : WinRM cannot
process the request. The following error with errorcode 0x80090311 occurred
while using Kerberos authentication: There are currently
no logon servers available to service the logon request.
Possible causes are:
-The user name or password specified are invalid.
-Kerberos is used when no authentication method and no user name are
specified.
-Kerberos accepts domain user names, but not local user names.
-The Service Principal Name (SPN) for the remote computer name and port
does not exist.
-The client and remote computers are in different domains and there is no trust
between the two domains.
After checking for the above issues, try the following:
-Check the Event Viewer for events related to authentication.
-Change the authentication method; add the destination computer to the
WinRM TrustedHosts configuration setting or use HTTPS transport.
Note that computers in the TrustedHosts list might not be authenticated.
-For more information about WinRM configuration, run the following
command: winrm help config. For more information, see the
about_Remote_Troubleshooting Help topic.
If I set $username to "username@DOMAIN.com", it quite happily establishes a session. I've gone ahead and confirmed that the UPN and SAMAccountName match up for the account. I'm incredibly curious as to what could be the cause of this as I've always been able to use "DOMAIN\username" on other servers.
If you have any thoughts or ideas I'd like to hear them!
User contributions licensed under CC BY-SA 3.0