Как вызвать удаленный рабочий стол через командную строку
Перейти к содержимому

Как вызвать удаленный рабочий стол через командную строку

  • автор:

Run command for remote desktop (RDP client)

Run command for remote desktop

Just open Run from start menu and type mstsc in the text box next to open and press enter.

This command mstsc can be used from command line too.

A system running Windows 7/Windows 10 allows only one remote desktop connection at a time, means only one remote user can work on it any time. A computer running Windows server edition can support remote sessions for multiple users at the same time.

Mstsc command

Every time we connect to the server it opens a new user session. To avoid this we can open a connection to the console. This allows us to login back to the same user session if we already have one. To do this we need to add /console switch to the mstsc command.

This command can be run from command prompt or from Run window.

Run command for opening remote desktop session in full screen mode

Add /f switch to the command.

Run command for specifying the remote computer name from the command itself

Use /v switch in this case.

Run command to specify remote desktop connection settings using a rdp file

A RDP file can be created using the ‘Save As‘ button in the General tab in mstsc(Remote desktop connection client) window.

These commands work on XP, Vista, Windows 7 and Server 2003/2008 operating systems.

Run command for Remote desktop manager

There is no Run command for opening remote desktop connection manager directly. It is usually installed in the path C:\Program Files\Remote Desktop Connection Manager\RDCman.exe . By specifying this complete path we can launch connection manager.

Relevant Posts:

Good information on the command line switches available with the mstsc command. thank you.

i would like to write command script to check whether the servers could RDP or not.
we have around 30 servers hence cant run mstsc /v:servername for each. Hence just would like to write cmd script to check all the servers. Could you please help me ?

You could do this by verifying the port is open through powershell.
test-netconnection -Port 3389

can you please assist me with the system to enable remote access desktop/working into the network user without being there physically,i have i.p address and computer name of the workstation and we are all in one network.

Possibly you only have Windows Home Edition, which doesn’t support Remote Connections.

Remote Desktop Assistance is a feature of Windows Pro Editions.

can user able to see the desktop in mstsc command

It is not mstsc/console anymore. Now it is mstsc/admin. You can also add it to a desktop shortcut by changing the Target to %windir%\system32\mstsc.exe -admin

“admin” is different than “console” actually. Admin allows you to boot another user. My bad.

Hello..is there any option to trigger MSTC on windows boot up, preferably with pre-specified destination server and credentials?

Also, if the user logs out of the terminal server, he should get logged out of the local desktop as well.

Команда Mstsc — подключение по RDP

Команда терминального сервера Mstsc используется для с оздания подключений к серверам терминалов или другим удаленным компьютерам с операционной системой Windows, редактирования существующего файла конфигурации подключения к удаленному рабочему столу (*.rdp) и переноса подключений Wndows (подключений, созданных с помощью диспетчера клиентских подключений) в новые файлы .rdp. Для принудительного выхода пользователей из системы используется команда LOGOFF.

Синтаксис и параметры команды Mstsc

mstsc.exe <файл_подключения|/v:сервер>[/console] [/f] [/w:ширина /h:высота]

mstsc.exe /edit»файл_подключения»

mstsc.exe /migrate

  • Файл_подключения — Задает имя файла .rdp для подключения.
  • /v:сервер — Задает имя удаленного компьютера, к которому необходимо подключиться.
  • /console — Подключается к сеансу консоли указанного компьютера под управлением Windows Server.
  • /f — Запускает подключение удаленного рабочего стола в полноэкранном режиме.
  • /w:ширина /h:высота — Указывает размеры экрана удаленного рабочего стола.
  • /edit — Открывает указанный файл .rdp для редактирования.
  • /migrate — Переносит устаревшие файлы подключений, созданные диспетчером клиентских подключений, в новые файлы .rdp. mstsc
Примечания по команде MSTSC
  • Для создания подключения к удаленной консоли необходимо быть администратором на сервере, к которому происходит подключение.
  • Для каждого пользователя файлы .rdp хранятся в папке «Мои документы» как скрытые.

Примеры команды MSTSC

Для подключения к удаленному рабочему столу сервера с IP-адресом 192.168.1.1 необходимо ввести команду: mstsc /v:192.168.1.1

Удаленный рабочий стол (RDP). Командная строка

Меня всегда напрягал момент поиска утилиты удаленного рабочего стола в меню Пуск. Никогда не помнил, в каком именно разделе она находится и всегда тратил много времени на поиск.
Так я долго мучился,пока один добрый человек (спасибо тебе, Паша) не показал мне:
Win + R, mstsc

2016-11-30_12-58-20

mstsc.exe — такое имя файла имеет утилита удаленного рабочего стола. Просто запомнить, легко вводить.

Параметр Описание
<имя файла> Задает имя файла .rdp для подключения.
/v:<Server[:<Port>] Задает имя удаленного компьютера, к которому необходимо подключиться и, опционально, номер порта подключения
/console Коннект к сеансу физической консоли (сеанс 0).
/admin Подключает к сеансу для администратирования.
/f Запуск удаленного рабочего стола в полноэкранном режиме.
/w:<ширина> Указывает ширину экрана удаленного рабочего стола.
/h:<высота> Указывает высоту экрана удаленного рабочего стола.
/public Запускает удаленный рабочий стол в общедоступном режиме.
/span Сопоставление ширины и высоты удаленного рабочего стола с локальным виртуальным рабочим столом и развертывание на несколько мониторов при необходимости.
/multimon Задает расположение мониторов сеанса служб удаленного рабочего стола в соответствии с текущей конфигурацией на стороне клиента.
/edit <имя файла> Открывает указанный файл .rdp для редактирования.
/migrate Переносит устаревшие файлы подключений, созданные диспетчером клиентских подключений, в новые файлы .rdp
/control разрешает управление сеансом
/? Показывает помощь по параметрам командной строки.

Ключ помощи показывает окно с командами, соответствующими текущей версии программы.

2016-11-30_10-41-49

Следует заметить, что ключ /console применяется для подключения к сеансу физической консоли на сервере (также известный как сеанс 0). Этот режим использовался в Windows Server 2003. В Windows Server 2008 или Windows Server 2008 R2,а также более новых версий, данный режим является устаревшим, т.к. сеанс 0 стал неинтерактивной сессией, зарезервированной для службы.

Поэтому RDC 6.1 не поддерживает ключ /console. Тем не менее, для обеспечения обратной совместимости, можно использовать параметр /admin для подключения к сеансу физической консоли на сервере под управлением Windows Server 2003. Подробнее можно почитать в данной статье: Изменения для удаленного администрирования в Windows Server 2008

Кроме того, ключ /admin обладает еще и следующими особенностями:

How to Start Remote Desktop Connection (mstsc) using Command Line

Remote Desktop Connection MSTSC Through Command LineRemote Desktop Connection MSTSC Through Command LineRemote Desktop Connection MSTSC Through Command Line

The Remote Desktop Connection (RDC) tool, also known as Microsoft Terminal Services Client (MSTSC), allows a user to connect to another computer remotely over the network using the Remote Desktop Protocol (RDP). Most users use this tool via its Graphical User Interface (GUI) which is convenient to use, but this article focuses on using the Remote Desktop via the command line.

Connecting to other computers using RDC through the command line allows you to control different settings and preferences of the connection. Windows allows a user to use certain switches to predefine the settings before the connection is made. For example, you can define the name or IP address of the remote computer, or adjust the RDC window size even before running the tool.

Table of contents

  • MSTSC commands and switches
    • Launch RDC from Run
    • Use RDC to connect via console
    • Launch RDC with IP address
    • Launch RDC with computer name
    • Launch RDC in full-screen mode
    • Check if RDP is enabled from Command prompt
    • Check if RDP is enabled from PowerShell
    • What is MSTSC?
    • How to open Remote Desktop from the command line?
    • How to add username and password to mstsc command line?
    • Is the RDP and RDC the same?

    Let us help you become aware of the switch options and how you can use them to configure your RDC connections.

    MSTSC commands and switches

    The conventional way to open the RDC in Windows is by searching for “Remote Desktop Connection” or “RDC” in Run and open the tool.

    rdc search

    Search for RDC

    This then opens the RDC tool where you can enter the name of IP address with port number (optional) of the remote computer that you want to connect to.

    tool

    RDC tool with IP address

    Most of you would already be aware of this method.

    This section covers the possible commands and switches that you can use with RDC via the command line. We shall start with the most basic ones and then continue.

    Launch RDC from Run

    The very basic command to run Remote Desktop Connection from the command line is via Run. Simply type in the following in Run and hit Enter.

    mstsc

    mstsc in Run

    Running this will open the RDC with a blank text field. However, with the addition of a few switches, you can change the settings and preferences of the RDC connection. Let us continue forward with a few examples.

    Use RDC to connect via console

    Although RDC fully supports GUI, you can also connect to remote machines through a console. This will help in case you wish to continue the session that you got disconnected from earlier. In contrast, a regular GUI-based RDC session creates a new session each time you connect to the same machine.

    Use the following command to connect to a remote computer via console:

    console

    mstsc /console

    Launch RDC with IP address

    You can also launch RDC along with the IP address of the machine to connect it with. If the port on the machine is changed from the default value, you can also add the port number. Use the following commands to do so:

    Replace IPAddress with the complete IP address of the remote computer that you want to connect with, and PortNumber with the port number if changed from its default value.

    ip and port

    mstsc with IP address and port number

    Launch RDC with computer name

    You can also connect to the remote computer by its unique computer name. The switch used for this is the same one used with the IP address and port number in the steps above.

    Replace ComputerName with the unique name of the remote device that you can find in its settings or properties.

    computer name

    RDC with computer name

    Launch RDC in full-screen mode

    You can also launch the RDC connection in full-screen mode. Here is how:

    fullscreen

    RDC in full-screen mode

    These switches can be combined into a single command to execute an RDC connection to your preferences. Here is an example:

    combined

    RDC full-screen with IP address and port number

    MSTSC commands and switches

    There are more commands and switches you can use with mstsc command-line to adjust your settings for the connection beforehand. Here is the complete list:

    <connectionfile> For a .rdp file required to make a connection (if applicable).
    /v: IP Address or computer name of the remote computer.
    /g: IP Address or device name of a Remote Gateway Server (if applicable).
    /admin To establish a connection with administrative privileges.
    /f View the Remote Desktop Window in full-screen mode.
    /w: To specify the width of the Remote Desktop Window.
    /h: To specify the height of the Remote Desktop Window.
    /public Run the Remote Desktop Connection publicly (less secure).
    /span To match the width and height of the Remote Desktop with the local desktop.
    /edit <connectionfile> To edit a .rdp file.
    /multimonTo make the monitor layout of the Remote Desktop Services session identical to the client-side configuration.
    /restrictedAdmin Connect to the remote PC in Restricted Administration mode. The credentials are not sent to the remote PC in this mode, protecting you if you connect to a compromised PC.
    /remoteGuard Connect your device to a remote device using the Remote Guard, which prevents sending credentials to a remote PC.
    /prompt To prompt you to put in credentials to connect to the remote PC.
    /shadow: The ID of the session that you want to connect to.
    /control Give control of the session when shadowing.
    /noConsentPrompt To allow shadowing without user consent.
    /migrate Migrate legacy connection files created with Client Connection Manager to new .rdp connection files.
    /? To get help in the command prompt.

    MSTSC commands and Switches

    These switches can have the following syntax in either Run or the Command Prompt:

    The parameters in the alligator brackets (< and >) are variables that you can adjust according to your preferences.

    Troubleshoot RDC via command line

    You can also troubleshoot Remote Desktop services through the command line. For example, if you are unable to connect to a device using the GUI RDC but have access via console, you can check whether there are any configurations to be made that will connect you via GUI successfully.

    Check if RDP is enabled from Command prompt

    You can run the following command to check the status of your device if RDP is enabled or disabled:

    listending

    Check RDP status from Command Prompt

    If the results come back as “Listening,” it means that RDP is enabled.

    Check if RDP is enabled from PowerShell

    Another method to check whether RDP is enabled is through Windows PowerShell. You can run the following commands in PowerShell and it will tell you whether the service is available or not.

    rdp is enabled

    Check RDP status from PowerShell

    If the script returns “RDP is enabled,” it means that it is.

    Frequently Asked Questions

    What is MSTSC?

    Microsoft Terminal Services Client (MSTSC) is a tool that allows a user to remotely connect to another device over the network as if they were physically present on the remote device.

    How to open Remote Desktop from the command line?

    You can open the Remote Desktop Connection window from Run or Command Prompt using mstsc. You may also add switches like /v and /f to control the connection’s arguments.

    How to add username and password to mstsc command line?

    You cannot add a username or password directly to the mstsc command. However, you can store the credentials in a generic key against the machine you want to connect to using these 2 commands:
    cmdkey /generic:"<server>" /user:"<user>" /pass:"<password>"
    mstsc /v:"<server>"

    Is the RDP and RDC the same?

    Remote Desktop Connection (RDC) is a tool used to establish a remote connection between devices. Remote Desktop Protocol (RDP) is the technology that RDC uses to create this remote connection.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *