{"id":15052,"date":"2019-09-19T15:35:26","date_gmt":"2019-09-19T15:35:26","guid":{"rendered":"https:\/\/www.top-password.com\/blog\/?p=15052"},"modified":"2019-09-23T07:44:47","modified_gmt":"2019-09-23T07:44:47","slug":"enable-remote-desktop-with-registry-powershell-or-command-prompt","status":"publish","type":"post","link":"https:\/\/www.top-password.com\/blog\/enable-remote-desktop-with-registry-powershell-or-command-prompt\/","title":{"rendered":"How to Enable Remote Desktop with Registry, PowerShell or Command Prompt"},"content":{"rendered":"<p>Is there a script to remotely enable remote desktop on Windows Server 2016? Previously we&#8217;ve covered <a href=\"https:\/\/www.top-password.com\/blog\/how-to-enable-remote-desktop-in-windows-8\/\" rel=\"noopener noreferrer\" target=\"_blank\">how to turn on remote desktop protocol (RDP) using the GUI interface<\/a>, but those methods don&#8217;t work in some scenarios where you do not have physical access to the computer on which you want to enable RDP. In this tutorial we&#8217;ll show you how to enable remote desktop remotely using Registry, PowerShell or Command Prompt.<\/p>\n<p><strong>Method 1: Enable Remote Desktop Using Registry Tweak<\/strong><\/p>\n<p>Once you are connected to the remote machine&#8217;s registry, navigate to the location: <code>HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server<\/code>. In the right pane, double-click the DWORD <strong>fDenyTSConnections<\/strong> and change its value from 1 to 0.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2019\/09\/fDenyTSConnections.png\" alt=\"\" width=\"561\" height=\"240\" class=\"alignnone size-full wp-image-15060\" \/><\/p>\n<p>Reboot your machine and remote desktop should now be accessible. If you need to disable remote desktop in future, just set the value of <strong>fDenyTSConnections<\/strong> to 1.<\/p>\n<p><strong>Method 2: Enable Remote Desktop Using PowerShell<\/strong><\/p>\n<p>Before getting started, you need to <a href=\"https:\/\/www.top-password.com\/blog\/run-powershell-commands-on-remote-computer\/\" rel=\"noopener noreferrer\" target=\"_blank\">establish a session with the remote computer using PowerShell<\/a>. Once connected, run the following PowerShell commands to enable remote desktop:<\/p>\n<p><code>Set-ItemProperty -Path 'HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server'-name \"fDenyTSConnections\" -Value 0<br \/>\nEnable-NetFirewallRule -DisplayGroup \"Remote Desktop\"<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2019\/09\/enable-remote-desktop-using-powershell.png\" alt=\"\" width=\"574\" height=\"167\" class=\"alignnone size-full wp-image-15061\" \/><\/p>\n<p>The first command will turn on remote desktop, while the second command will activate the firewall rules that allow remote desktop connections.<\/p>\n<p>When you need to disable remote desktop later, run the following commands instead:<\/p>\n<p><code>Set-ItemProperty -Path 'HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server'-name \"fDenyTSConnections\" -Value 1<br \/>\nDisable-NetFirewallRule -DisplayGroup \"Remote Desktop\"<\/code><\/p>\n<p><strong>Method 3: Enable Remote Desktop Using Command Prompt<\/strong><\/p>\n<p>If you can open a remote Command Prompt window via SSH, PsExec or WinRS, run the following commands to enable remote desktop and configure Windows Firewall to allow remote desktop connections:<\/p>\n<p><code>reg add \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\" \/v fDenyTSConnections \/t REG_DWORD \/d 0 \/f<br \/>\nnetsh advfirewall firewall set rule group=\"remote desktop\" new enable=yes<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2019\/09\/enable-remote-desktop-using-cmd.png\" alt=\"\" width=\"561\" height=\"281\" class=\"alignnone size-full wp-image-15062\" \/><\/p>\n<p>To disable remote desktop, execute the below commands:<\/p>\n<p><code>reg add \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\" \/v fDenyTSConnections \/t REG_DWORD \/d 1 \/f<br \/>\nnetsh advfirewall firewall set rule group=\"remote desktop\" new enable=No<\/code><\/p>\n<p>That&#8217;s all!<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Is there a script to remotely enable remote desktop on Windows Server 2016? Previously we&#8217;ve covered how to turn on remote desktop protocol (RDP) using the GUI interface, but those methods don&#8217;t work in some scenarios where you do not have physical access to the computer on which you want to enable RDP. In this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,10,1894,3,39],"tags":[4332,4331,4334,4333],"class_list":["post-15052","post","type-post","status-publish","format-standard","hentry","category-others","category-tips-tricks","category-windows-10","category-windows-7","category-windows-8","tag-enable-remote-desktop-command-line","tag-enable-remote-desktop-powershell","tag-enable-remote-desktop-registry","tag-remotely-enable-remote-desktop-windows-10"],"_links":{"self":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/15052","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/comments?post=15052"}],"version-history":[{"count":15,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/15052\/revisions"}],"predecessor-version":[{"id":15088,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/15052\/revisions\/15088"}],"wp:attachment":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/media?parent=15052"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/categories?post=15052"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/tags?post=15052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}