RDP connection by making it .bat file

6,167

This functionality was removed from the mstsc.exe application. I think you may do either of:

  • Save from RDP the connection details as an .rdp file and launch it directly or via mstsc.

  • Use PowerShell, for example the script Connect-Mstsc.ps1. You will find some more information on this post, google for details on individual commands.

Share:
6,167

Related videos on Youtube

B.B.M
Author by

B.B.M

Loves to explore new technologies.

Updated on September 18, 2022

Comments

  • B.B.M
    B.B.M over 1 year

    I want to automate the RDP connection by making a bat file. But it still keeps on asking me the password.

    I created two files 1.hello.cmd 2.hello1.bat

    In hello.cmd I had put

    cmdkey /generic:"ipaddress" /user:"username" /pass:"password"
    rem cmdkey /generic:TERMSRV:"ipaddress" /user:"username" /pass:"password"
    

    and in hello1.bat I created

    mstsc /v:ipaddress
    

    How do i correct this and make it automate

    Please help!!!

  • B.B.M
    B.B.M almost 5 years
    Hi, thanks for your advice. I am a complete noob of using Powershell. Can you tell me how do I run the Connect-Mstsc.ps1?
  • harrymc
    harrymc almost 5 years
    The script is well documented. Search in it for examples, all headed by ".EXAMPLE" and followed by explanations in "Description". The parameters are defined first, each under ".PARAMETER". Pick your example and use it either from the PowerShell IDE or if your prefer from batch via the command powershell -Command "command-line-with-params". Google for information - there's lots of.