Windows 2022
Sponsored Link

Remote Desktop : Server Side Settings2021/12/14

Enable Remote Desktop to connect to the Server from other Computers.
This exmaple shows to enable single session feature of Remote Desktop which Windows Client OS also has.
[1] On CUI configuration, Run PowerShell enable Remote Desktop feature.
Copyright (C) Microsoft Corporation. All rights reserved.

# display current Remote Desktop setting
# 0 = allow Remote Desktop
# 1 = disallow Remote Desktop
PS C:\Users\Administrator> Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" 

fDenyTSConnections : 1
PSPath             : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server
PSParentPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
PSChildName        : Terminal Server
PSDrive            : HKLM
PSProvider         : Microsoft.PowerShell.Core\Registry

# display current Remote Desktop connection setting
# 0 = allow all
# 1 = allow connections only from computers running Remote Desktop with Network Level Authentication (recommended)
PS C:\Users\Administrator> Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" 

UserAuthentication : 1
PSPath             : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal
PSParentPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal
PSChildName        : RDP-Tcp
PSDrive            : HKLM
PSProvider         : Microsoft.PowerShell.Core\Registry

# set to allow Remote Desktop
PS C:\Users\Administrator> Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value "0" 

# set to allow connections only from computers running Remote Desktop with Network Level Authentication
PS C:\Users\Administrator> Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "UserAuthentication" -Value "1" 

# on command configuration, it needs to configure Windows Firewall manually
# rules for Remote Desktop are already set by default, so it needs to enable them manually
PS C:\Users\Administrator> Get-NetFirewallRule | Where-Object Name -like 'RemoteDesktop*' | Out-String -Stream | Select-String "^Name","Enabled" 

Name                          : RemoteDesktop-In-TCP-WS
Enabled                       : False
Name                          : RemoteDesktop-In-TCP-WSS
Enabled                       : False
Name                          : RemoteDesktop-Shadow-In-TCP
Enabled                       : False
Name                          : RemoteDesktop-UserMode-In-TCP
Enabled                       : False
Name                          : RemoteDesktop-UserMode-In-UDP
Enabled                       : False

# enable it
PS C:\Users\Administrator> Set-NetFirewallRule -Name "RemoteDesktop-In-TCP-WS" -Enabled True 

# enable them all
PS C:\Users\Administrator> Get-NetFirewallRule | Where-Object Name -like 'RemoteDesktop*' | Set-NetFirewallRule -Enabled True 
Remote Desktop : Server Side Settings (GUI)
On GUI configuration, set like follows.
[2] Run Server Manager and Select [Local Server] on the left Pane, then click [Disabled] for [Remote Desktop] section.
[3] Check a box [Allow remote connections to this computer].
[4] The message that Firewall exception for Remote desktop is enabled, click [OK] button.
[5] Remote Desktop function has turned to [Enabled].
Matched Content