What is Mstsc.exe & How to Properly Use it

MSTSC lets you establish Remote Desktop connection

Reading time icon 4 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

Key notes

  • MSTSC lets you run the Microsoft Remote Desktop client to connect with PCs on the same server.
  • Here we have explained the complete mstsc syntax and the meaning of each of its parameters.
What is MSTSC

The mstsc.exe is located in Windows 11 inside the C:\System32\ folder. MSTC stands for Microsoft Terminal Service Client and is an executable file.

In this guide, we will discuss some important things such as what is mstsc.exe and how you can properly use it. Let us get right into it.

What is mstsc.exe used for?

Remote Desktop is an important Windows feature that is used by millions across the globe. With the mstsc.exe or Microsoft Terminal Service Client (MSTSC), you can run the Microsoft Remote Desktop (RDP) client.

Meaning, you can use the mstsc command to establish a remote connection with someone else’s computer. This can let you edit or tweak things as if you were using their computer by being physically present there.

You have to be on the same network to establish the remote connection. The mstsc command is run using the Windows Command Prompt and it is vital to manage the desktop.

What is the syntax for the mstsc command?

The syntax of the mstsc command is:

mstsc.exe [<connectionfile>] [/v:<server>[:<port>]] [/g:<gateway>] [/admin] [/f<fullscreen> ] [/w:<width> /h:<height>] [/public] [/multimon] [/l] [/restrictedadmin] [/remoteguard] [/prompt] [/shadow:<sessionid>] [/control] [/noconsentprompt]
mstsc.exe /edit <connectionfile>

Below is the basic understanding of common mstsc parameters:

ParameterDescription
<connectionfile>The name of the .rdp file required for connection.
/v:<server>[:<port>]Specifies the remote computer or the port number to which you want to connect.
/g:<gateway>It is the RD Gateway server that will be used for the connection. Only required if endpoint remote PC is specified with /v.
/adminTo establish the connection as an admin.
/fTo view the remote desktop in full-screen mode.
/w:<width>To specify the width of the Remote Desktop window.
/h:<height>To specify the height of the Remote Desktop window.
/publicRuns Remote Desktop in public mode, where passwords and bitmaps aren’t cached.
/multimonConfigures the Remote Desktop Services session monitor layout identical to the client-side configuration.
/lLists the monitor attached to the local PC and the ID associated with each monitor.
/edit <connectionfile>Opens up the specified .rdp file for editing.
/restrictedAdminThis mode won’t send your credentials to the remote PC.
/remoteGuardThis mode prevents credentials from being sent to the remote PC.
/promptAsks for your credentials when you connect to the remote PC.
/shadow:<sessionID>Specifies the ID of the session to shadow.
/controlLets you control the session when shadowing.
/noConsentPromptLets you control shadowing without user consent.
/?Displays help at the CMD.

How do I run mstsc.exe?

  1. Press the Win + R keys to open the Run dialogue.
  2. Type mstsc and press Enter.
    (If you want to open the remote connection in fullscreen mode, then you need to type mstsc.exe /f. Also, you can use the above parameters to their advantages as listed above.)
  3. Type the computer name or the IP address of the remote desktop and hit Connect.

Let us now understand how you can enable or disable the remote desktop. For that, check out the next two sections.

How do I enable Remote Desktop?

  1. Press the Win key to open the Start menu.
  2. Open Command Prompt as an admin.
  3. Type the below command and press Enter. reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
  4. Run the below command to enable remote desktop. netsh advfirewall firewall set rule group="remote desktop" new enable=yes

How do I disable Remote Desktop?

  1. Press the Win key to open the Start menu.
  2. Open Command Prompt as an admin.
  3. Type the below command and press Enter. reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
  4. Run the below command to disable remote desktop. netsh advfirewall firewall set rule group="remote desktop" new enable=No

How can I fix mstsc.exe crashes?

1. Run the SFC scan

  1. Press the Win key to open the Start menu.
  2. Open Command Prompt as an admin.
  3. Execute the below command. sfc /scannow
  4. Wait for the SFC Scan process to complete and fix the corrupt files.
  5. Restart your PC.

When you come across a mstsc.exe crash or error, then we would suggest you fix the corrupt system files on your PC. This is because often new Windows updates can crash certain system processes.

That is it from us in this guide. Let us know in the comments below, if this helped you understand what mstsc.exe is and how you can use it to establish a remote desktop connection.

More about the topics: Remote Desktop Connection