Users can use the Remote Desktop Protocol to connect to the Windows server's graphical interface. Here's how to enable or disable remote desktop services on Windows Server using the graphical interface and Windows powershell.
To enable RDP using the graphical interface, you can click "Start Menu" and then select "Server Manager", select "Local Server" in the left panel, and wait for the server status to refresh. Click the "Disabled" option again to open the "Remote" TAB of the "System Properties" window. In the Remote Desktop section, which allows remote connections to this server, the sub-option "Allow connections only from computers running remote desktops (recommended)" can be enabled or disabled depending on the machine connected to the server. If the local machine is Linux-based, you need to disable this option. When this option is selected, a warning message appears notifying the user that the server will enable the required firewall rules to allow remote connection to the server from any source network. Click "OK" to continue.
Click OK in the System Properties window to complete the process of enabling the remote desktop on the server.
By refreshing Server Manager, you can confirm that the status of the remote desktop service is now Enabled. Set-ItemProperty cmdlet modifies registry values to enable/disable remote desktops:
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0
Set up the Windows Firewall to allow remote desktop connections with the Enable-NetFirewallRule cmdlet:
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
After starting the remote desktop, you can test the remote connection to the server with the Remote Desktop Connection application or the rdesktop command (Linux). Click on "Start Menu" in Windows, search for "Remote Desktop Connection" and open the application. Enter the IP address of the server you want to connect to remotely in the "Computer" field and click "Connect." Enter your username and password in the Windows Security window, and then click "OK" to remotely connect to the server.
In Linux distributions, the most common command is rdesktop. Another available command is xfreerdp. Connect to the server remotely with the rdesktop command (replace the IP address with the exact IP address of the server).
rdesktop 123.123.123.123
The Remote Desktop Connection window appears, and you can access the remote server by entering your user name and password.
To access the server, click on "Start Menu" and then select "Server Manager". In the Server Manager window, click Local Server in the left pane to refresh the server status. The Remote Desktop option will appear as Enabled. Click the "Enabled" option to open the "Remote" TAB of the "System Properties" window. In the Remote Desktop section, select Do not allow remote connection to this computer. Click "OK" to continue. By refreshing Server Manager, you can confirm that the status of the remote desktop service is now Disabled.
Modify the registry value with the Set-ItemProperty cmdlet to enable/disable the remote desktop:
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 1
After you disable the remote desktop, you can test the remote connection to the server using the Remote Desktop Connection application.