Пожалуйста, рассмотрите следующий сценарий:
Есть 2 сервера: server1
и server2
, оба в одной сети и в одном домене. Цель состоит в том, чтобы открыть PSSession из server1
в server2
, используя локального пользователя из server2
в качестве идентификатора:
PS @SERVER1 > $session = New-PSSession -ComputerName server2 -Credential server2\username
Локальный пользователь на server2
является членом группы WinRMRemoteWMIUsers_
Если используется доменный пользователь, то все работает нормально:
PS @SERVER1 > $session = New-PSSession -ComputerName server2 -Credential domain\username
Ошибка, полученная при попытке подключения в качестве локального пользователя:
New-PSSession : [server2] Connecting to remote server server2 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.
В сообщении об ошибке есть The following error with errorcode 0x80090311 occurred while using Kerberos authentication
и -Kerberos accepts domain user names, but not local user names.
, поэтому попытка подключения была предпринята после выполнения следующего на server1:
PS @SERVER1 > winrm set winrm/config/client '@{TrustedHosts="server2"}'
Попытка запустить PSSession
после выполнения команды по-прежнему терпит неудачу.
Какой еще шаг можно предпринять?
-Credential server2\username
попробуйте-Credential (get-credential)
. -Credential (должен) никогда не принимает dom\username или просто имя пользователя, он ищет объект pcredential. @Roman, по сути, создает в своем ответе объект pcredential. Если вы хотите повторно использовать объект учетных данных, сохраните его в переменной$cred = get-credential
, а затем передайте командлету:-Crendential $cred
о Get-Credential - person brendan62269   schedule 20.04.2017