Hi, I would recommend mRemoteNG as a connection manager. It allows you to import servers directly from AD or from a list in a text file and if a lot of the servers use the same credentials, it allows you to specify them at top level and choose per server if you inherit those creds or you can select certain servers for different creds as needed. Very useful if you manage lots of servers
RDP a server by command line
Hello,
Can someone please help me to share the command line that I can RDP servers using my user name and account.
Connect-Mstsc -ComputerName '<VM Name>' -User '<domain/username>' -Password '<password>'
When I tried the above command I am getting this error:
Connect-Mstsc : The term 'Connect-Mstsc' is not recognized as the name of a cmdlet, function, script file, or operable
program.
I tried this too, but no luck:
mstsc /v:<VM Name> -User '<domain/username>' -Password '<password>'
I am getting the RDP windows for those servers if I just use the below commands. But RDP window asking my password (User name is automatically taking):
Connect-Mstsc -ComputerName '<VM Name>'
Or
mstsc /v:<VM Name>
So my need is by a command line (user name and password), I need to connect the server via RDP properly.
Can someone please help ?
5 answers
Sort by: Newest
-
-
Andreas Baumgarten 98,621 Reputation points MVP
2020-12-07T21:34:38.663+00:00 Saving the RDP config in a *.rdp file with MSTSC:
Enter Servername and click on
Show options
Enter username and check the
Allow me to save credentials
Save the RDP file withSave as
Connect to the serverHere you will find a full how-to: https://www.nextofwindows.com/how-to-save-password-in-a-remote-desktop-connection-in-windows-8
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten -
Ricardo Bohner 1 Reputation point
2020-12-07T20:35:23.013+00:00 Why don't you create an *.rdp file you can add your username and password there. Than you run it via command line or however you want.
-
Andreas Baumgarten 98,621 Reputation points MVP
2020-12-07T20:19:34.353+00:00 Could you please try the cmdkey without the quotes:
cmdkey /generic:<servername> /user:<username> /pass:<password>
If this doesn't work the next you can try:
cmdkey /TERMSRV:<servername> /user:<username> /pass:<password>
If you have 100+ servers you have to connect why you need to connect via command line? I just want to understand the use case.
There are very good Remote Management Solutions on the market to get manage and connect via RDP to servers with integrated credential management. I am using Royal TS on a daily base: https://www.royalapps.com/ts/win/features
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten -
Andreas Baumgarten 98,621 Reputation points MVP
2020-12-07T19:48:38.903+00:00 It's not possible to add the username and password to the
mstsc.exe
.But this should work:
# Create credentials cmdkey /generic:"<servername>" /user:"<username>" /pass:"<password>" # Connect MSTSC with servername and credentials created before mstsc /v:<servername> # Delete the credentials after MSTSC session is done cmdkey /delete:TERMSRV/<servername>
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten