Want to access your Windows PC from another location? Enabling Remote Desktop Protocol (RDP) is vital for remote control, but navigating through numerous GUI windows can be time-consuming. This article offers a step-by-step guide to using PowerShell to enable or disable the Remote Desktop feature on your Windows machine. This way, you can save time and embrace the automation power of PowerShell to connect to your computer remotely!
What is Remote Desktop?
Remote Desktop is a feature in Windows that allows you to connect to your computer from another location. This feature lets you remotely control your Windows PC, access files, run applications, and perform other tasks.
Why Use PowerShell to Enable Remote Desktop?
PowerShell enables you to automate various system tasks, including enabling or disabling the Remote Desktop feature. By using PowerShell commands, you can save time and avoid going through numerous GUI windows. If you own a Mac, you can check our guide for Mac remote connection.
Steps to PowerShell Enable Remote Desktop
Follow these simple steps to enable or disable Remote Desktop using PowerShell:
1. Check the Current Status of the Remote Desktop
- Right-click on “This PC” and go to “Properties.“
- Click on “Change settings” to view the current status of the Remote Desktop (enabled or disabled).
2. Open PowerShell as an Administrator
- Go to the Start menu and type “PowerShell.“
- Right-click on “Windows PowerShell” and select “Run as administrator.“
- Click “Yes” to confirm.
3. Enter the Command to Enable Remote Desktop
- Copy and paste the following command to PowerShell Enable Remote Desktop (set value to 0):
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0
- Press Enter. You can check the Microsoft guide for more detailed insight.
4. Verify the Change
- Close the PowerShell window.
- Once again, go to “Change settings” in your computer’s properties.
- You will now see that Remote Desktop is allowed.
5. To Enable Remote Desktop from Firewall
- To enable Remote Desktop from your firewall, use the command:
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
How to Disable Remote Desktop Using PowerShell?
To disable, you must follow the below-written steps and make sure you understand all the security perspectives before you get into the steps.
- Type PowerShell in the search bar.
- Launch Powershell and run it as administrator.
- Execute the below-written command.
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 1
- You must use the following command to disable the remote desktop through the firewall.
Disable-NetFirewallRule -DisplayGroup "Remote Desktop"
Requirements for Enabling RDP Through Command
To enable Remote Desktop Protocol (RDP) remotely via PowerShell, the system must adhere to the specific criteria laid out below; It will streamline the remote connection to your server through PowerShell.
- WinRM Service Activation: The Windows Remote Management (WinRM) service must run on the remote computer. You can check how to enable RDP on Linux through our other guide.
- Administrator Permissions: Having administrator permissions on the remote device is essential to execute the commands.
- Firewall Configuration: Windows Defender Firewall rules must accept PowerShell Remoting on WinRM ports TCP 5985 and 5986. To enable these rules, run the following command:
netsh advfirewall firewall set rule group="Windows Remote Management" new enable=yes
Frequently Asked Questions
Q1. How Do I Enable Remote Desktop Using PowerShell in Windows 10?
People often look for specific guidance for their operating system, and Windows 10 is widely used. This question targets users wanting to enable Remote Desktop through PowerShell on Windows 10 specifically.
Q2. Is It Safe to Enable Remote Desktop with PowerShell?
Security is a primary concern for many users using PowerShell Enable Remote Desktop. This question appeals to those who want to understand the safety implications of using PowerShell for this purpose.
Q3. How Can I Disable Remote Desktop Through PowerShell if Needed?
Understanding how to reverse a change is often as vital as knowing how to implement it. This question is for users who want to know how to turn off the PowerShell Enable Remote Desktop feature after enabling it with PowerShell.
Q4. What Are the Firewall Settings for Remote Desktops in PowerShell?
Firewall settings can be a complex topic, and configuring them properly is essential for successful Remote Desktop connections. This question targets users looking to understand or modify their firewall settings when using PowerShell to enable Remote Desktop.
Using PowerShell to enable remote desktop is an efficient way to manage remote connections to your Windows PC. The process is simple, and you can PowerShell Enable Remote Desktop or disable the feature with just a few commands. Consult your system’s documentation or seek professional assistance if you encounter any difficulties. By utilizing the power of PowerShell, you’ll have remote access to your computer at your fingertips.