How to Run Commands to Enable and Launch Remote Desktop
Remote Desktop is a built-in Windows feature that allows users to connect to a distant computer visually and interact with its desktop environment as if they were sitting right in front of it.
While enabling and using RDP can be done through a graphical user interface (GUI), utilizing remote desktop run command that offers a more efficient and scriptable approach, particularly for system administrators managing multiple machines.
In this guide, we will discuss how to run commands to enable and launch Remote Desktop and provide detailed step-by-step instructions.
Part 1: How to Run Commands to Enable Remote Desktop
Before establishing a remote connection, RDP needs to be activated on the target computer. Here's how to achieve this using two popular command-line tools:
Enable Remote Desktop Using Command Prompt
Step 1: Run Command Prompt as Administrator
Press the Windows key and type "cmd".
Right-click on "Command Prompt" and select "Run as administrator." This is crucial as enabling command to run RDP that requires administrative privileges.
Step 2: Enable RDP with a Single Command
Type the following command and press Enter:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
fDenyTSConnections
value within the Terminal Server
key. Setting this value to 0
enables RDP connections.Step 3: Open Firewall Rule for RDP
Although enabling RDP in the registry allows connections, the firewall might still block them. Use this command to open the necessary firewall rule:
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
Now, you will see the below command that’s meant the remote desktop function has been updated.
Extra: Disable Remote Desktop with Command Prompt
If you need to disable RDP later, use the following command in Command Prompt (as administrator):
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
netsh advfirewall firewall set rule group=" remote desktop" new enable=No
Enable Remote Desktop Using PowerShell
PowerShell offers another powerful way to manage system settings, including enabling RDP.
Step 1: Run PowerShell as Administrator
Press the Windows key, type "powershell".
Next, right-click on "Windows PowerShell" to select "Run as administrator."
Step 2: Enable RDP with a Single Command
Type the following command and press Enter:
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0
fDenyTSConnections
value in the registry.Step 3: Open Firewall Rule for RDP
Use the following command to enable the firewall rule for RDP connections:
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
Extra: Disable Remote Desktop with PowerShell
To disable RDP later using PowerShell, run the following command as administrator:
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 1
Disable-NetFirewallRule -DisplayGroup "Remote Desktop"
Tip: How to Check If Remote Desktop Is Enabled
There are two ways to verify if RDP is enabled:
Way 1: Using the Windows Registry
Press the Windows key, type "regedit" in the search bar and press Enter (Run as administrator if prompted) or click on the "Run as administrator" option.
Alternatively, right-click on the "Registry Editor" to select "Run as administrator."
Now, navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
Click on the fDenyTSConnections
value. If the data value is set to 0
, RDP is enabled. Conversely, a value of 1
indicates a disabled state.
Way 2: Using the Group Policy Editor (For Pro Editions)
This method applies to Windows Pro editions and above. Press the Windows key, type "gpedit.msc", and then press Enter, or click on the "Open".
Navigate to: Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Connections.
Double-click on the "Allow users to connect remotely by using Remote Desktop Services" policy.
If the policy is set to "Enabled", RDP is enabled. A disabled or "Not Configured" state indicates otherwise.
Now, if you want to use this function (Allow users to connect remotely by using Remote Desktop Services), mark on "Enabled" option. Then click on the "Apply" & "OK" button.
Now, you will see, the state is showing "Enabled."
Part 2: How to Run Commands to Launch Remote Desktop
Once RDP is enabled, you can initiate remote connections using the mstsc command-line tool. The mstsc command creates a connection to a remote desktop session host server or other remote computer.
Here are three variations for different connection scenarios, you just need to open Command Prompt on your computer and type the command:
mstsc /console
This command establishes a remote connection in console mode. The remote desktop session will lack a graphical interface and function more like a command prompt on the target machine. This is useful for server administration tasks where a graphical environment is not necessary.
mstsc /f
The /f flag launches the remote desktop session in full-screen mode. This fills your local machine's display entirely with the remote desktop, providing a more immersive experience.
mstsc /v <computer_name_or_ip_address>
This command format allows you to specify the target computer for the remote connection. Replace <computer_name_or_ip_address>
with the actual hostname or IP address of the remote machine you want to access.
Additional Options with mstsc
The mstsc command offers various additional options to customize your remote desktop experience. Here are a few examples:
/l:<username>: Specifies the username to use for authentication on the remote computer.
/p:<password>: Provides the password associated with the username (not recommended for security reasons). It's safer to enter the password at the login prompt after initiating the connection.
/w:<width>x<height>: Sets the dimensions of the remote desktop window on your local machine.
Part 3: Importance of Remote Desktop Run Command
Let's unleash the power and explore the key reasons to embrace the remote desktop run command.
Rapid Diagnosis Remotely
Imagine a user reporting a mysterious software glitch on their remote machine. Traditionally, troubleshooting could involve lengthy back-and-forth communication.
The run command changes the game. You can directly execute diagnostic tools, analyze event logs, or even run system file checks – all from your own computer.
This expedites troubleshooting, minimizes user downtime, and allows you to identify the root cause quickly.
Effortless Software Deployment
Managing software across multiple remote desktops can be a time-consuming task. The run command streamlines this process by enabling automated script execution.
Imagine pushing a new application installation script to several machines simultaneously. This ensures consistency in the deployment process and eliminates the risk of errors associated with manual installations.
Proactive Security Management
Cybersecurity is paramount. The run command empowers you to take a proactive approach by launching security scans and updating antivirus definitions directly on remote systems. This helps identify and patch vulnerabilities before they become a security breach.
Bonus: Best Remote Desktop Solution for Individuals/Businesses
Does your Windows edition not support Remote Desktop? Or you don't want to run tedious commands to enable and launch Remote Desktop? AirDroid Remote Support, one of the best Windows remote desktop software brings you the solution!
With AirDroid Remote Support, you can remotely control Windows, whether it's a personal computer or a computer deployed by an organization. It speeds up troubleshooting and has advanced features such as lightweight management.
Final Notes
In a nutshell, enabling and running Remote Desktop with commands empowers users with a powerful and versatile tool for remote access.
Whether you're a system administrator managing a network of computers or a personal user needing to access a home machine remotely, understanding these command-line techniques can significantly enhance your workflow and provide greater control over your remote desktop connections.
Leave a Reply.