Протокол Remote Desktop Protocol (RDP) позволяет удаленно подключиться к рабочему столу компьютера с Windows и работать с ним, как будто это ваш локальный компьютер. По умолчанию RDP доступ в Windows запрещен. В этой статье, мы покажем, как включить и настроить RDP доступ в Windows 10 и Windows Server 2016/2019.
Содержание:
- Включаем удаленный рабочий стол в Windows 10
- Как включить RDP доступ с помощью PowerShell?
- RDP доступ к Windows Server 2016/2019
- Включение RDP с групповых политик в домене Active Direcrtory
- Как удаленно включить RDP на компьютере Windows?
Включаем удаленный рабочий стол в Windows 10
Самый простой способ включить RDP доступ в Windows – воспользоваться графическим интерфейсом.
Откройте свойства системы через панель управления, или выполнив команду SystemPropertiesRemote.
Перейдите на вкладку Remote Settings (Удаленный доступ), включите опцию Allow remote connection to this computer (Разрешить удалённые подключения к этому компьютеру).
В целях безопасности желательно разрешить подключение только с клиентов RDP с поддержкой протокола NLA (Allow connections only from computers running Remote Desktop with Network Level Authentication/ Разрешить подключение только с компьютеров, на которых работает удаленный рабочий стол с проверкой подлинности на уровне сети).
Сохраните изменения, нажав ОК.
По умолчанию право на подключение к компьютеру через RDP есть только у членов группы локальных администраторов. Если вам нужно разрешить RDP доступ другим пользователям, нажмите кнопку Select Users.
Все пользователи, которых вы укажете здесь будет добавлены в локальную группу Remote Desktop Users. Вы можете в командной строке вывести список пользователей в этой группе:
net localgroup "Remote Desktop Users"
или
net localgroup “Пользователи удаленного рабочего стола”
Чтобы добавить нового пользователя в группу доступа RDP, выполните:
net localgroup "Remote Desktop Users" /add publicuser
В русской версии Windows измените название группы на “Пользователи удаленного рабочего стола”.
В новых билдах Windows 10 классическая панель для включения RDP доступа теперь спрятана и Microsoft рекомендует пользоваться новой панелью Setting.
- Перейдите в Settings -> System —> Remote Desktop;
- Включите опцию Enable Remote Desktop;
- Подтвердите включение RDP на компьютере.
Обратите внимание, что вы не можете включить RDP доступ к редакции Windows 10 Home. RDP сервер работает только на Windows 10 Pro и Enterprise. Впрочем, есть обходное решение.
Обратите внимание, что по умолчанию при включении Remote Desktop, включаются две опции:
- Keep my PC awake for connection when it is plugged in ;
- Make my PC discoverable on private networks to enable automatic connection from a remote device
На жмите на ссылку “Advanced settings”. Здесь можно включить использование протокола “Network Level Authentication” для RDP подключений (рекомендуется).
Если на компьютере включен Windows Defender Firewall (брандмауэр), то нужно проверить, что в нем разрешены входящие RDP подключения. По умолчанию для RDP подключений используется порт TCP
3389
, а в последних билдах Windows также используется
UDP 3389
( см. статью про кейс с черным экраном вместо рабочего стола при RDP доступе).
Перейдите в панель управления и выберите элемент Windows Defender Firewall. Откройте список стандартных правил брандмауэра Windows, щелкнув в левом столбце по ссылке Allow an app or feature through Windows Firewall.
Проверьте, что правило Remote Desktop включено для профиля Private (домашняя или рабочая сеть) и, если необходимо, для профиля Public (общедоступные сети).
Подробнее про типы сетей и профили брандмауэра Windows здесь.
Если нужно, вы можете дополнительно ограничить длительность RDP сессий с помощью GPO.
Теперь к данному компьютеру можно подключится с помощью RDP клиента. Встроенный RDP клиент Windows –
mstsc.exe
. Он сохраняет всю историю RDP подключений с компьютера. Поддерживается копирование файлов между локальным и удаленным компьютером прямо через буфер обмена RDP.
Также вы можете использовать менеджеры RDP подключений, такие как RDCMan или mRemoteNG, или альтернативные клиенты.
Для удобства пользователей пароль для RDP подключения можно сохранить в Windows Credential Manager.
Как включить RDP доступ с помощью PowerShell?
Вы можете включить RDP доступ в Windows с помощью пары PowerShell команд. Это гораздо быстрее:
- Запустите консоль PowerShell.exe с правами администратора;
- Включите RDP доступ в реестре с помощью командлета Set-ItemProperty:
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0
Чтобы закрыть RDP доступ, измените значение fDenyTSConnections на 1.
- Разрешите RDP подключения к компьютеру в Windows Defender Firewall. Для этого включите предустановленное правило :
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
- Если нужно добавить пользователя в группу в локальную группу RDP доступа, выполните:
Add-LocalGroupMember -Group "Remote Desktop Users" -Member 'a.petrov'
Чтобы проверить, что на компьютере открыт RDP порт, воспользуйтесь командлетом Test-NetConnection:
Test-NetConnection -ComputerName deskcomp323 -CommonTCPPort rdp
RDP доступ к Windows Server 2016/2019
В отличии от десктопной редакции Windows 10, в Windows Server по умолчанию поддерживается два одновременных RDP подключения. Эти подключения используются администраторами для управления сервером.
Включается RDP в Windows Server аналогично. Через SystemPropertiesRemote, через Server Manager или командами PowerShell, рассмотренными выше.
Вы можете использовать Windows Server в качестве терминального сервера. В этом случае множество пользователей могут одновременно подключаться к собственному рабочему столу на сервере. Для этого нужно установить и настроить на сервере роль Remote Desktop Session Host. Это требует приобретения специальных RDS лицензии (CAL). Подробнее о RDS лицензировании здесь.
Для дополнительно защиты RDP сессий можно использовать SSL/TLS сертификаты.
Включение RDP с групповых политик в домене Active Direcrtory
Если вам нужно включить RDP доступ сразу на большом количестве компьютеров, можно воспользоваться групповыми политиками (GPO). Мы подразумеваем, что все компьютеры включены в домен Windows.
- Запустите консоль управления доменными GPO
gpmc.msc
; - Создайте новую (или отредактируйте уже существующую) групповую политику и привяжите ее к целевой OU с компьютерами или серверами;
- Переключитесь в режим редактирования политики и перейдите в секцию GPO Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Connections;
- Найдите и включите политику Allow Users to connect remotely by using Remote Desktop Services, установив ее в Enable;
- Обновите параметры групповых политик на клиентах;
- После применения данной политики вы сможете подключится ко всем компьютерам по RDP (политика применится как к десктопным клиентам с Windows 10, так и к Windows Server). Если нужно, вы можете более тонко нацелить политики на компьютеры с помощью WMI фильтров GPO.
- Если на компьютерах включен Windows Defender Firewall, нужно в этой же GPO разрешить RDP-трафик для доменного профиля. Для этого нужно активировать правило Windows Firewall: Allow inbound Remote Desktop Exceptions (находится в разделе Computer Configuration -> Administrative Templates -> Network -> Network Connections -> Windows Firewall -> Domain Profile).
Подробнее о настройке правил брандмаура Windows через GPO рассказано здесь.
Как удаленно включить RDP на компьютере Windows?
Также вы можете удаленно включить RDP на любом компьютере Windows. Для этого у вас должен быть удаленный доступ к этому компьютеру (через PowerShell или WMI) и ваша учетная запись состоять в группе локальных администраторов на этом компьютере.
Вы можете удаленно включить RDP через реестр. Для этого на удаленном компьютере должна быть включена служба Remote Registry (по умолчанию она отключена). Чтобы запустить службу:
- Запустите консоль управления службами (
services.msc
); - Выберите Connect to another computer и укажите имя удаленного компьютера;
- Найдите в списке службу Remote Registry, измените тип запуска на Manual (ручной) и затем запустите службу – Start.
Тоже самое можно выполнить удаленно из командной строки с помощью встроенной утилиты
sc
(позволяет создавать, управлять или удалять службы Windows):
sc \\WKMDK22SQ65 config RemoteRegistry start= demand
sc \\WKMDK22SQ65 start RemoteRegistry
Затем на локальном компьютере
- Запустите редактор реестра
regedit.exe
- Выберите в меню Файл пункт Connect Network Registry (Подключить сетевой реестр)
- Укажите имя или IP адрес удаленного компьютера, на котором нужно включить службу RDP;
- Перейдите в раздел
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server
; - Найдите параметр fDenyTSConnections (тип REG_DWORD). Если данный ключ отсутствует – создайте его. Измените его значение на 0, чтобы включить RDP.
Для отключения RDP доступа нужно изменить значение fDenyTSConnections на 1.
Сразу после этого без перезагрузки удаленный компьютер должен стать доступным по RDP.
Но гораздо быстрее можно включить RDP в реестре удаленого компьютера через командную строку:
REG ADD "\\WKMDK22SQ65\HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
Если на удаленном компьютере настроен PowerShell remoting, вы можете выполнить на нем удаленную команду через Invoke-Command:
Invoke-Command -Computername WKMDK22SQ65 -ScriptBlock {Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" –Value 0}
Если в Windows установлен OpenSSH сервер, вы можете подключиться к нему любым ssh клиентом и внести изменения в реестр в локальной ssh сессии.
Также вы можете подключиться к удаленному компьютеру и включить RDP через WMI:
$compname = “WKMDK22SQ65”
(Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace root\CIMV2\TerminalServices -Computer $compname -Authentication 6).SetAllowTSConnections(1,1)
on October 2, 2010
Remote desktop can be enabled/disabled by opening My computer properties and then by changing the settings in the ‘Remote‘ tab. We can do the same by editing registry key settings. This is explained below. Remote desktop is also called Terminal services or TS or RDP. This is an in-built remote desktop software for Windows users.
Enable remote desktop from CMD
- Open registry editor by running regedit from Run.
- Go to the node
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server
- Change the data of the value
fDenyTSConnections
to 0.
We can enable remote desktop from windows command line by running the following command.
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
To disable remote desktop we need to run the below command.
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
Reboot or logoff is not required after running the above command. I have tested this on Windows XP and Windows 7 and it has worked fine. It would work fine on Windows Vista too.
Enable Remote assistance:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fAllowToGetHelp /t REG_DWORD /d 1 /f
Relevant Posts:
Run command for Remote Desktop
Remote desktop and Terminal Services : Frequently asked questions
If you want to use the Remote Desktop feature without opening the Windows Settings panel, then you can enable Remote Desktop using Command Prompt or Windows PowerShell. If you have a remote desktop client on your mobile or another computer, you will be able to connect it and use your PC remotely.
Remote Desktop is a well-known facility for Windows 11/10 computers that lets you connect two computers or mobile so that an individual can access another computer remotely. You can fix some problems on the computer via mobile or do other jobs according to your requirements. You need a Remote Desktop client like Microsoft Remote Desktop or so on your mobile to connect two devices.
It is possible to enable to disable Remote Desktop via Windows Settings. You need to head to System > Remote Desktop to access the option. However, let’s assume that the Windows Settings panel is not opening due to some reasons, and you need to turn on the Remote Desktop feature. Then you can use this method to start the Remote Desktop using the command line.
To enable Remote Desktop using Command Prompt and Windows PowerShell, follow these steps-
- Open Command Prompt or PowerShell with administrator privilege
- Set value of fDenyTSConnections REG DWORD to 0
- Add a Firewall rule
- Restart your computer
- Start using Remote Desktop in Windows 10.
The commands are not the same for Command Prompt and Windows PowerShell.
1] Enable RDP firewall using Command Prompt
To get started, open the Command Prompt with administrator privilege. You can search for it in the Taskbar search box, and click the Run as administrator option that appears on your screen. After that, enter this following command and hit Enter:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
By default, the value of fDenyTSConnections is set to 1. This command will change the value to 0.
Next, execute the following command:
netsh advfirewall firewall set rule group="remote desktop" new enable=yes
This command will add and update three rules in the Firewall so that you can start using the Remote Desktop.
2] Enable RDP using Windows PowerShell
You need to open the Windows PowerShell with administrator privilege and enter the following command and hit Enter:
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0
This command will change the fDenyTSConnections value to 0. Now, you need to execute the following command to add rules in the Firewall:
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
After that, you will be able to use Remote Desktop in Windows 10.
In case you want to disable Remote Desktop using Command Prompt and Windows PowerShell, you need to enter these steps.
Related: Remote Desktop option is greyed out.
Disable Remote Desktop using Command Prompt or PowerShell
To disable Remote Desktop using Command Prompt and Windows PowerShell, follow these steps-
- Open Command Prompt or PowerShell with administrator privilege
- Set value of fDenyTSConnections REG DWORD as 1
- Add a Firewall rule
- Restart computer.
To know more, you need to read on.
Disable Remote Desktop using Command Prompt
You need to set the default value of fDenyTSConnections as 1. For that, use this command-
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
Now you need to remove rules from the Firewall. For that, use this command-
netsh advfirewall firewall set rule group="remote desktop" new enable=No
Disable Remote Desktop using PowerShell
You need to change the value of fDenyTSConnections as 1. You can do that by using this command-
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 1
The second command will let you remove the rules from the Firewall:
Disable-NetFirewallRule -DisplayGroup "Remote Desktop"
How do I know if RDP is enabled or not?
If you want to know the status of the RDP protocol on your Windows 11/10 system, then open the Registry Editor. After that, access the Terminal Services and Terminal Server Registry keys. There, look for the fDenyTSConnections DWORD (32-bit) Value. If the value data of this value is set to 0, then RDP is enabled. If it is set to 1, then RDP is disabled.
How to restart the RDP service using PowerShell?
If you want to restart the Remote Desktop Services using PowerShell, then first open the Windows PowerShell as administrator. After that, execute the command given below:
Restart-Service -Force -DisplayName "Remote Desktop Services"
You can also use the following command to restart the RDP service:
Restart-Service -Force -Name "TermService"
That’s all! I hope this simple tutorial will be helpful for you.
- To enable Remote Desktop on Windows 10, open Command Prompt (admin) and run the “reg add “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server” /v fDenyTSConnections /t REG_DWORD /d 0 /f” and “netsh advfirewall firewall set rule group=”remote desktop” new enable=Yes” commands.
On Windows 10, you can use the Remote Desktop feature to remotely access a computer or server to help other users or manage services without being physically present at the location.
Although you can manage the feature through the Settings app, you can also turn Remote Desktop on or off on Windows 10 using commands with Command Prompt or PowerShell. You may want to use this method to create a script to configure Remote Desktop on multiple computers more quickly. Or you can send the script to a user, allowing them to set up the feature without additional steps automatically.
This guide will teach you the steps to use Command Prompt to enable or disable Remote Desktop and open the required firewall ports for a successful connection on Windows 10.
- Enable Remote Desktop from Command Prompt
- Disable Remote Desktop from Command Prompt
Important: Remote Desktop is not a feature available on Windows 10 Home. It is only on Windows 10 Pro, Enterprise, and Education. It is also recommended you create a full backup of your computer before proceeding, as modifying the registry can cause irreversible damage to your system.
To enable the remote desktop protocol with Command Prompt, use these steps:
-
Open Start on Windows 10.
-
Search for Command Prompt, right-click the top result, and select the Run as administrator option.
-
Type the following command to enable the remote desktop protocol and press Enter:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
-
(Optional) Type the following command to enable remote desktop through the Windows Firewall and press Enter:
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
Once you complete the steps, the protocol will enable on Windows 10, and you will be able to access the device remotely.
Disable Remote Desktop from Command Prompt
To turn off the remote desktop protocol with Command Prompt, use these steps:
-
Open Start.
-
Search for Command Prompt, right-click the top result, and select the Run as administrator option.
-
Type the following command to disable the remote desktop protocol and press Enter:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
-
(Optional) Type the following command to disable Remote Desktop through the Windows Firewall and press Enter:
netsh advfirewall firewall set rule group="remote desktop" new enable=No
After you complete the steps, the Remote Desktop service will be turned off, and the Windows Firewall port will be closed.
This guide focuses on Command Prompt, but you can use the same commands to manage the remote desktop protocol using PowerShell.
Mauro Huculak is a
Windows How-To Expert and founder of
Pureinfotech
(est. 2010). With over 21 years as a technology writer and IT Specialist,
Mauro specializes in Windows, software, and cross-platform systems such as Linux, Android, and macOS.
Certifications:
Microsoft Certified Solutions Associate (MCSA),
Cisco Certified Network Professional (CCNP),
VMware Certified Professional (VCP),
and
CompTIA A+ and Network+.
Mauro is a recognized Microsoft MVP and has also been a long-time contributor to Windows Central.
You can follow him on
YouTube,
Threads,
BlueSky,
X (Twitter),
LinkedIn and
About.me.
Email him at [email protected].
The Windows Remote desktop can be enable with the command line such as CMD and Powershell. Here we enable remote desktop using command prompt in Windows 10. You can use this method on all Microsoft Windows server and Workstation systems.
In Microsoft Windows operating systems, you can connect to a computer running Windows from another computer running Windows that’s connected to the same network or the Internet. For example, you can use all of your work computer’s programs, files, and network resources from your home computer, and it’s just like you’re sitting in front of your computer at work.
To connect to a remote computer, that computer must be turned on; it must have a network connection, Remote Desktop must be enabled. You must have network access to the remote computer (this could be through the Internet), and you must have permission to connect. For permission to connect, you must be on the list of remote desktop users. Before you start a connection, it’s a good idea to look up the name of the computer you’re connecting to and to make sure Remote Desktop connections are allowed through its firewall.
Enable Remote Desktop using Command Line
To enable remote desktop using command line, you must have administrator permission in Windows. The command line interfaces, command prompt or Powershell, must run as administrator.
Enable remote desktop process:
- Run Windows Command Prompt.
- Execute registry command to enable remote desktop.
- Enable Remote Desktop on system Firewall.
- Test Remote Desktop Connectivity between two systems.
Let’s run the command prompt as administrator and follow the article to enable remote desktop with command line.
1. Type the below command to enable remote desktop.
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
The result must be the same as above screenshot. If you face any issue while running command, check the command structure and try again.
2. To disable remote desktop, just type the below command and run it.
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
3. Allow the Remote desktop on your Windows firewall system with netsh command.
netsh advfirewall firewall set rule group="remote desktop" new enable=yes
Related: Configure Windows IP Address with Netsh
4. Now, you need to add a user account to remote desktop users group. To do this using the “net localgroup” command.
net localgroup "remote desktop users" Shais /add
The username “Shais” has been added successfully to “Remote Desktop Users” group. You can test the remote desktop user members with below command.
net user Shais
That’s all you need to enable remote desktop using command line on any Windows operating systems.
If you want to do all with a graphical interface, follow the below Microsoft step by step guide to enable remote desktop.
Enable Remote Desktop Connection with GUI
If your user account doesn’t require a password to sign in, you’ll need to add a password before you’re allowed to start a connection with a remote computer.
To allow remote connections on the computer, you want to connect to:
- Open System by clicking the Start button, right-clicking Computer, and then click Properties.
- Click Remote settings.If you’re prompted for an administrator password or confirmation, type the password or provide confirmation. Under Remote Desktop, select one of the three options.
- Click Select Users.If you’re an administrator on the computer, your current user account will automatically be added to the list of remote users, and you can skip the next two steps.
- In the Remote Desktop Users dialog box, click Add.
- In the Select Users or Groups dialog box, do the following:
- To specify the search location, click Locations, and then select the location you want to search.
- In entering the object names to select, type the name of the user that you want to add, and then click OK.
- The name will be displayed in the list of users in the Remote Desktop Users dialog box. Click OK, and then click OK again.
Note: You can’t connect to a computer that’s asleep or hibernating, so make sure the settings for sleep and hibernation on the remote computer are set to Never. (Hibernation is not available on all computers.)
To look up the computer name of the remote computer:
- On the remote computer, open System by clicking the Start button, right-clicking Computer, and then click Properties.
- Under Computer name, domain, and workgroup settings, you can find your computer name, and it’s full computer name if your computer is on a domain.
To allow Remote Desktop connections through a Windows Firewall:
If you’re having trouble connecting, Remote Desktop connections might be getting blocked by the firewall. Here’s how to change that setting on a Windows PC. If you’re using another firewall, make sure the port for Remote Desktop (usually 3389) is open.
- On the remote computer, click Start and select Control Panel.
- Click System and Security.
- Then click Allow a program through Windows Firewall under Windows Firewall.
- And click Change settings and then check the box next to Remote Desktop.
- Click OK to save the changes.
To set a password for your user account
Your user account must have a password before you can use Remote Desktop to connect to another computer.
- Click Start and select Control Panel.
- Double-click User Accounts.
- Select Change your Windows Password under User Accounts.
- Click Create a password for your account and follow the instructions on the screen.
To start Remote Desktop on the computer, you want to work from:
- Open Remote Desktop Connection by clicking the Start button. In the search box, type Remote Desktop Connection, and then, in the list of results, click Remote Desktop Connection.
- In the Computer box, type the name of the computer that you want to connect to, and then click Connect. (You can also type the IP address instead of the computer name.)
Finally, hope you can enable remote desktop using command line in your network environment.