The Comprehensive Guide To MSTSC Command-Line Options
One of the most long-standing and major features of Windows is Remote Desktop. To run Microsoft’s Remote Desktop Protocol (RDP) client, a command-line interface called Microsoft Terminal Services Client (MSTSC) is used.
These command-line options allow users to enable Remote Desktop connection, and remotely connect with another computer or a Remote Desktop Session Host server with the same level of fluidity and control as one would experience if they were physically operating the remotely accessed machine.
Users can also edit pre-existing Remote Desktop Connection (RDC) “.rdp” configuration files.
MSTSC command lines are used within the Windows command line.
This article will provide detailed information on what RDP command-line options are out there, and instructions on how to use the most popular ones.
List of all MSTSC commands
The most common MSTSC command line arguments used are “/v” and “/f”. Users can enact the command to create almost instantaneous connections to a remote computer sharing a network using the Internal Protocol (IP) address.
Please Note: When using a computer’s name to remotely access that machine, users must share the same network. Otherwise, users must have already configured DNS (or set up within a host file).
The MSTSC syntax is as follows:
MSTSC [<connection file> ] [/v:<server[:port]> ] [/g:<gateway> ]
[/admin] [/f[ullscreen]] [/w:<width> /h:<height> ] [/public] |
[/span] [/multimon] [/edit "connection file"] [/restrictedAdmin]
[/remoteGuard] [/prompt] [/shadow:<sessionID> [/control][/noConsentPrompt]]
Please see below for a list of the available MSTSC command line arguments:
The name of the .rdp file needed to establish a connection
The remote computer or server you want to connect to
The RD Gateway Server utilized for the connection. Needed only if/when the endpoint remote PC is specified with “/v”
Establish the connection as administrator
View the Remote Desktop Window in full-screen mode
Specify the width of the Remote Desktop Window
Specify the height of the Remote Desktop Window
Run Remote Desktop Connection publicly
Match the width and height of the Remote Desktop to the local desktop
Edit the specified “.rdp” file
Make the monitor layout of the Remote Desktop Services session identical to the client-side configuration
Connect to the remote PC in the Restricted Administration mode. The credentials are not sent to the remote PC in this mode, meaning you are protected if you connect to a compromised PC
Connect your device to a remote device via Remote Guard, which prevents credentials being transmitted to a remote PC
Prompts you to enter credentials to connect to the remote PC
The ID of the session to be shadowed
Permits control over the session when shadowing
Permits shadowing without user consent
Migrate legacy connection files created with Client Connection Manager to new .rdp connection files
Displays help in the command prompt.
MSTSC /admin command
In the current version of Remote Desktop Connection (RDC), when Remote Desktop Session Host (RDSH) role service is installed on the remote machine, running “mstsc /admin” will establish the connection as an administrator and disable do the following for this connection only:
- • Remote Desktop Services client access licensing;
- • Time zone redirection;
- • RD Connection Broker redirection;
- • Remote Desktop Easy Print;
- • Plug and Play device redirection;
- • Alters the remote session theme to Windows Classic View (if available).
Open connection in full screen
Via the run app (or shortcut), users would usually open an RDP connection using the remote computer’s name or an IP address:
mstsc /v:computer_name /f
mstsc /v:192.168.123.123 /f
Set height and width for the connection screen
The users seeking to assign/force height and width for the remote desktop screen should check out the following cmd line option example:
mstsc /v:192.168.255.255 /w:1024 /h:768
mstsc /v:192.168.255.255 /w:1600
How To Span Across Multiple (2+) Monitors
The noticeable struggle when remotely accessing the computer is that users can only see one of the monitors during the RDP connection. To have some additional space to fit a dual-monitor setup, users can use the “/span” command: “mstsc /v:192.168.123.123 /span”
For anyone who intends to use the “/span” command, the remote desktop window is treated as one continuous monitor.
As you can see, utilizing Remote Desktop command-line options open up a plethora of customization, convenience, and opportunity when using RDP. We hope this guide has provided you with the insight and confidence necessary to start experimenting with MSTSC commands to enhance your remote desktop experience.