Странное поведение при использовании WinRM через powershell, иногда работает, а иногда нет
Я настраивал Powershell Remoting для всех наших клиентских компьютеров (на прошлой неделе я выпустил GPO), и я могу протестировать WSMan практически на всех из них, и я получаю хороший ожидаемый ответ.
Теперь на одном из наших серверов (наш SCCM 2012 со всеми последними обновлениями) вы работаете и не работаете, и это сводит меня с ума.
[Примечание для следующего: это непрерывный вход на сервер через RDP в течение нескольких дней]
Это было в пятницу днем
PS C:\Windows\System32\WindowsPowerShell\v1.0\Traces> Enter-PSSession -ComputerName D0373910
[D0373910]: PS C:\Users\A-RJS39534\Documents> Exit-PSSession
Затем в субботу утром из того же окна Powershell
PS BC1:\> Enter-PSSession -ComputerName D0373910
Enter-PSSession : Connecting to remote server D0373910 failed with the following error message : The WinRM client cannot process the request. It
cannot determine the content type of the HTTP response from the destination computer. The content type is absent or invalid. For more information,
see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName D0373910
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (D0373910:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
Затем в воскресенье утром я вернулся в
PS C:\Windows\System32\WindowsPowerShell\v1.0\Traces> Enter-PSSession -ComputerName D0373910
[D0373910]: PS C:\Users\A-RJS39534\Documents> Exit-PSSession
И теперь я снова вернулся к этому
PS C:\Windows\System32\WindowsPowerShell\v1.0\Traces> Enter-PSSession -ComputerName D0373910
Enter-PSSession : Connecting to remote server D0373910 failed with the following error message : The WinRM client cannot process the request. It
cannot determine the content type of the HTTP response from the destination computer. The content type is absent or invalid. For more information,
see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName D0373910
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (D0373910:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
Это сводит с ума! Я установил параметры реестра для избыточных билетов Kerberos, перезапущенных сервисов, отключенного и повторно включенного удаленного взаимодействия Powershell.
Просто кажется, что удача в розыгрыше, когда он хочет работать.
Пара вещей, чтобы упомянуть
- Сервер имеет PS 4.0, и большинство клиентов имеют 2.0
- Система, которую я показывал, была доступна для проверки перед каждой из указанных выше попыток.
- Это НЕ для Exchange Server (похоже, это ЕДИНСТВЕННАЯ вещь, которая возникает, когда я ищу что-нибудь о "Тип контента отсутствует или недействителен." С WinRM или Powershell remoting)
Обновление 29.11.2016
Журнал событий
Level Date and Time Source Event ID Task Category
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 33 WSMan Session deinitialize Closing WSMan Session completed successfuly
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 8 WSMan Session deinitialize Closing WSMan Session
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 16 WSMan API call Closing WSMan shell
Error 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 142 Response handling WSMan operation CreateShell failed, error code 2150858999
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 254 None Activity Transfer
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 11 WSMan API call Creating WSMan shell with the ResourceUri: http://schemas.microsoft.com/powershell/Microsoft.PowerShell and ShellId: 65AA33C1-1009-411E-8DEB-31E08D35AB17
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 10 WSMan API call Setting WSMan Session Option (16) - WSMAN_OPTION_TIMEOUTMS_SIGNAL_SHELL with value (60000) completed successfully.
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 10 WSMan API call Setting WSMan Session Option (17) - WSMAN_OPTION_TIMEOUTMS_CLOSE_SHELL with value (60000) completed successfully.
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 10 WSMan API call Setting WSMan Session Option (12) - WSMAN_OPTION_TIMEOUTMS_CREATE_SHELL with value (180000) completed successfully.
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 10 WSMan API call Setting WSMan Session Option (1) - WSMAN_OPTION_DEFAULT_OPERATION_TIMEOUTMS with value (180000) completed successfully.
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 10 WSMan API call Setting WSMan Session Option (25) - WSMAN_OPTION_LOCALE with value (en-US) completed successfully.
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 10 WSMan API call Setting WSMan Session Option (26) - WSMAN_OPTION_UI_LANGUAGE with value (en-US) completed successfully.
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 10 WSMan API call Setting WSMan Session Option (34) - WSMAN_OPTION_USE_INTEARACTIVE_TOKEN with value (0) completed successfully.
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 31 WSMan Session initialize WSMan Create Session operation completed successfuly
Information 11/29/2016 10:19:13 AM Microsoft-Windows-WinRM 6 WSMan Session initialize Creating WSMan Session. The connection string is: D0375599-/wsman?PSVersion=4.0
Второе обновление 29.11.2016
Мне в спешке пришло в голову, что я никогда четко не объяснил, что я пытаюсь сделать.
Я МОГУ подключить удаленный сеанс Powershell К серверу SCCM (2008 R2).
то, что я НЕ могу сделать, это подключиться к другой системе с сервера SCCM (обратите внимание на все рассматриваемые системы, которые я пытался, МОГУ подключиться к ним с моего рабочего стола Windows 10 через удаленное взаимодействие с Powershell)