Windows Server 2012 R2: Cannot install role Remote Desktop Services

Hi,

Issue: You try to install “Remote Desktop Services” role and it ends in error “unable to connect to powershell remoting“.

Powershell Remoting uses WinRM. Which is based on HTTP. For an “HowTo” enable WinRM scroll down to the end the post.

The error mentioned above often occurs in case of the http request/field size is to small in conjunction with AD Accounts which have an large AD access token (larger then 12Kbit). Adjust the max size of both values (default 16384). Also remote Connections with “Server Manager” are affected.


    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters
    Value: MaxRequestBytes
    Type: DWORD
    Data: 65564 (Decimal)

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters
    Value: MaxFieldLength
    Type: DWORD
    Data: 65564 (Decimal)

From command line

reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters /v MaxRequestBytes /t REG_DWORD /d 65564 /f
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters /v MaxFieldLength /t REG_DWORD /d 65564 /f

Other error messages related to this issue are

  • HTTP Error 400 Bad Request
  • HTTP Error 400 The size of the request headers is too long

 
After applying keys reboot your system.

Sometimes you also have to increase the MaxMemoryPerShellMB value

Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1000

If you want to reconfigure/enable/disable WinRM here are some command line examples:

Disable WinRM

Disable-PSSessionConfiguration
Disable-PSRemoting

Remove any listener

winrm delete winrm/config/listener?address=*+transport=HTTP

Enable WinRM

Enable-PSRemoting
Enable-PSSessionConfiguration

Run QuickConfig

Set-WSManQuickConfig

Check if winrm is enabled

winrm get winrm/config

Check for listeners

winrm e winrm/config/listener

Check WinRM Parameters with the Powershell WSMan DriveProvider

get-childItem WSMan:\localhost

Michael

Some references
Disable WinRM
Install Remote Desktop Services

Leave a Reply Cancel reply