mstsc Command Tutorial – Connect RDP (Remote Desktop Connections)

RDP or Remote Desktop Connection is a popular and defacto protocol for Windows operating systems. RDP connection shortcuts can be created by using the mstsc command with different options and configurations. Mstsc is the short form of the Microsoft Terminal Services which is the official name of the RDP services and features.

mstsc Command Syntax

The mstsc command has the following syntax.

mstsc FILE SERVER OPTIONS
  • FILE is optional and provided to edit *.rdp file.
  • SERVER is the remote RDP server.
  • OPTIONS are different configurations.

mstsc Command Options and Parameters

PARAMETERDESCRIPTION
FILERDP file which will be edited
/vRemote server and port information
/adminConnect as Administrator
/fConnect Full Screen
/wSpecify screen width
/hSpecify screen height
/publicRun public mode which will not cache bitmap and password
/edit FILEEdit *.rdp file
/migrateUpdate old version *.rdp file into new version
/?Display help information
/promptPrompt for username and password even saved previously
/shadow

Print mstsc Help Information

Help information about the mstsc command can be displayed with the /? option. We can see that if the current session is GUI the help information is provided as a message box.

>mstsc /?
Print mstsc Help Information

Connect To RDP

We can connect to a remote RDP server by providing the remote server domain name or IP address with the /v option like below. In the following example, we will provide the server hostname dc.kaleinfo.com .

>mstsc /v:dc.kaleinfo.com

We can also connect remote RPD server by using the IP address where the IP address can be in IPV4 or IPv6.

>mstsc /v:192.168.10.10

The following screen will ask for the username and password. We can also check the Remember me to save credentials username and password.

Connect Non-Default RDP Port

Default RDP port is 3389 and while using the mstsc command this port is used implicitly. So you do not have to provide the port value explicitly. But if you need to connect and RDP port which is non-default you can add this port number after the server hostname or IP address by separating the double colon like below.

> mstsc /v:192.168.10.10:1234

> mstsc /v:dc.kaleinfo.com:1234

Connect RDP In Fullscreen

By default mstsc connect remote RDP server with the remote servers provided resolutions or width and height. But the RDP protocol provides the ability to connect in full screen mode for the client which will be more comfortable. The /f option is used to connect in fullscreen mode with the RDP.

> mstsc /f /v:192.168.10.10

> mstsc /f /v:dc.kaleinfo.com

Connect RDP with Specified Width and Height

The mstsc command provides the ability to connect RDP server with a custom resolution by specifying the width and height. The width can be specified with the /w option and height can be specified with the /h option by providing the pixel count or resolution.

> mstsc /w:1020 /h:780 /v:192.168.10.10

> mstsc /w:1020 /h:780 /v:dc.kaleinfo.com

Connect As Administrator User

The /admin option can be used to connect remote RDP server as an administrator.

> mstsc /admin /v:192.168.10.10

Connect Public Mode – Do Not Cache Bitmap and Password

Security is an important part of today’s IT. While connecting remote systems the username and password are stored in the memory. To prevent this cache and also disable the cache f bitmap you can use the /public option.

> mstsc /public /v:192.168.10.10

Leave a Comment