how to connect to remote desktop via batch file RRS feed

  • Question

  • i want to connect to remote desktop via batch file by providing username and password in the file, so that the remote connection doesnt prompts username/password window.

    Already i ve tried 
    cmdkey /generic: /user:"username" /pass:"password" 
    mstsc /v:

    This method still prompts connect window and then security certificate window. is there a way by which i can directly move into the desktop of the remote machine ?

    • Moved by Bill_Stewart Friday, August 14, 2015 5:47 PM Off-topic
    Tuesday, June 9, 2015 9:08 PM

All replies

  • Open the remote applet and select to save credentials.  After that you will not need to enter creds.  The admin of a system can set the TS to refuse credentials that are not type in so contact you TS admin to see if this is possible.

    Post user questions like this in the Microsoft answers forum.


    Tuesday, June 9, 2015 9:32 PM
  • Remote Desktop Connection Usage

    MSTSC [<connection file>] [/v:<server[:port]>] [/admin] [/f[ullscreen]] [/w:<width> /h:<height>] [/public] | [/span] [/multimon] [/edit "connection file"] [/restrictedAdmin] [/prompt] [/shadow:<sessionID> [/control] [/noConsentPrompt]]

    "connection file" -- Specifies the name of an .RDP file for the connection.

    /v:<server[:port]> -- Specifies the remote computer to which you want to connect.

    /admin -- Connects you to the session for administering a server.

    /f -- Starts Remote Desktop in full-screen mode.

    /w:<width> -- Specifies the width of the Remote Desktop window.

    /h:<height> -- Specifies the height of the Remote Desktop window.

    /public -- Runs Remote Desktop in public mode.

    /span -- Matches the remote desktop width and height with the local virtual desktop, spanning across multiple monitors, if necessary. To span across monitors, the monitors must be arranged to form a rectangle.

    /multimon -- Configures the Remote Desktop Services session monitor layout to be identical to the current client-side configuration.

    /edit -- Opens the specified .RDP connection file for editing.

    /restrictedAdmin -- Connects you to the remote PC or server in Restricted Administration mode. In this mode, credentials won’t be sent to the remote PC or server, which can protect you if you connect to a PC that has been compromised. However, connections made from the remote PC might not be authenticated by other PCs and servers, which might impact app functionality and compatibility. Implies /admin.

    /prompt -- Prompts you for your credentials when you connect to the remote PC or server.

    /shadow:<sessionID> -- Specifies the sessionID you wish to view.

    /control -- Allows control of the session.

    /noConsentPrompt -- Allows shadowing without user consent.


    Tuesday, June 9, 2015 9:43 PM
  • I recommend using and RDP file set to save creds.


    Tuesday, June 9, 2015 9:44 PM