Я пытаюсь удаленно подключить PowerShell к серверу Exchange. Это отдельный домен AD. (Подключение domainA к domainB) Я могу подключиться с domainA к серверам на других доменах просто отлично. Я получаю следующую ошибку:
PS Y:\Personal\scripts> $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://server1.domainB.tld/PowerShell/ -Authentication Kerberos -Credential $cred
New-PSSession : [server1.domainB.tld] Connecting to remote server server1.domainB.tld failed with the following error message : The user name or password is incorrect. For more
information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:12
+ $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri ht ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : LogonFailure,PSSessionOpenFailed
Это не относится к этому серверу, я получаю те же результаты на двух других серверах в том же домене.
Мое имя пользователя в формате UPN me@domainB.tld
Если я использую domainB\me
Я получаю следующую ошибку:
PS Y:\Personal\scripts> $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://server1.domainB.tld/PowerShell/ -Authentication Kerberos -Credential $cred
New-PSSession : [server1.domainB.tld] Connecting to remote server server1.domainB.tld 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.
At line:1 char:12
+ $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri ht ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : AuthenticationFailed,PSSessionOpenFailed
Я также пытался подключиться к домену B из других доменов и получил те же результаты. Я предполагаю, что где-то есть разрешение, которое нужно установить, но я не уверен, какое именно.
wsman:\localhost\client\trustedhosts
установлен на правильные значения
Я без проблем могу подключиться к RDP с теми же учетными данными, поэтому я знаю, что мои учетные данные действительны. Я тоже администратор домена. Серверы - Windows 2012 R2.
PSRemoting включен
[PS] D:\>Enable-PSRemoting -Force
WinRM is already set up to receive requests on this computer.
WinRM is already set up for remote management on this computer.
PSSessionConfiguration
Name : microsoft.powershell
PSVersion : 4.0
StartupScript :
RunAsUser :
Permission : BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllowed
Name : microsoft.powershell.workflow
PSVersion : 4.0
StartupScript :
RunAsUser :
Permission : BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllowed
Name : microsoft.powershell32
PSVersion : 4.0
StartupScript :
RunAsUser :
Permission : BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllowed
Name : microsoft.windows.servermanagerworkflows
PSVersion : 3.0
StartupScript :
RunAsUser :
Permission : NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators AccessAllowed
Кроме того, я пробовал удаленное взаимодействие с сервера в domainB на server1.domainB, и он отлично работает. Так что это как-то связано с подключением извне домена.
Тестовая аутентификация в IIS работает нормально
Удаление -Authentication Kerberos
или используя Negotiate
также приводит к ошибкам
wsman trusthosts - добавлено полное доменное имя клиента на сервер. Добавлены FQDN и IP сервера клиенту. Без изменений.
Что мне нужно исправить, чтобы здесь можно было удаленно?
Вы пытались удалить -Authentication Kerberos
из вашего New-PSSession? У меня есть аналогичные скрипты для управления доверенными серверами обмена доменами, но я не указываю тип аутентификации.
$session = New-PSSession -ConnectionUri "https://mail.server.com/Powershell" -ConfigurationName Microsoft.Exchange -Credential $cred
Если бы это была проблема с привилегиями, в ошибке было бы написано что-то вроде «доступ запрещен».
Почему-то сервер на самом деле не знает вашего пользователя (или PW неверен).
Вы сказали, что пытаетесь подключиться «из DomainA к DomainB». Похоже, ваш пользователь находится в DomainA, но вы сообщаете серверу, что ваш пользователь находится в DomainB.
Попробуйте подключиться к me@domainA.tld
или me\domainA
.