In this tutorial, we will show you how you can enable or disable remote desktop using PowerShell. When you allow remote connections to your PC, you can use another device to connect to your PC and have access to all of your apps, files, and network resources as if you were sitting at your desk.
Remote desktop in Windows is a feature that allows a user to connect to a computer in another location, see that computer’s desktop and interact with it as if it were local.
The Remote Desktop feature is by default turned off when you install the Windows Server or Client operating system. However, if you need to access your PC from a remote location or from a different computer, the RDP feature must be enabled.
You can manually enable or disable the remote desktop on a computer if necessary by going into the advanced system settings. However, when you need to turn on or turn off the remote desktop feature on multiple Windows computers, you can use methods such as Microsoft Intune, Group Policy, PowerShell, batch scripts, etc.
Enable Remote Desktop using PowerShell
To enable the remote desktop using PowerShell:
- Right-click on the Start button and select “Windows PowerShell (Admin)“.
- Copy and paste the below command into the PowerShell window.
- Press Enter to run the script.
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 0
The above command sets the value of the ‘fDenyTSConnections‘ registry key to 0, which activates the remote desktop feature.
Disable Remote Desktop using PowerShell
To disable the remote desktop using PowerShell:
- Right-click on the Start button and select “Windows PowerShell (Admin)“.
- Copy and paste the below command into the PowerShell window.
- Press Enter to run the script.
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 1
The above command sets the value of the ‘fDenyTSConnections‘ registry key to 1, which deactivates the remote desktop feature.
That’s all we wanted to cover in this guide. Thank you for reading. If you enjoyed it, please like and share this article, tagging🔖CloudGuides.