0
How do you specify a user when using the mstsc command in powershell? While I can specify the server, I cannot specify a user.
Let's assume Server name = server01, User name = Test, Password = PW
Example 1 mstsc /v:server01 /user server01\test /password PW
This only brings up the "Remote Desktop Connection Usage" help menu.
Example 2 mstsc /v:server01
This works, bringing up the normal RDP connection prompt for User & password.
Example 3 mstsc /v:server01 /user server01\test
Even trying to just specify the user fails, bringing up the help menu again.
Some website articles on powershell suggest using "Connect-RDP" or "Connect-Mstsc" instead of just "mstsc" as per above examples, but this only brings up an error code. My knowledge of powershell is very basic, so I'm probably making a simple mistake somewhere.
Using this script https://gallery.technet.microsoft.com/scriptcenter/Connect-Mstsc-Open-RDP-2064b10b/view/Discussions and running the command
– Yisroel Tech – 2018-07-19T03:23:41.217Connect-Mstsc -ComputerName 18.186.48.107:3389 -User workpc\Yisroel -Password YisroelGithub -Verbose
Yisroel, this still brings up an error Connect-Mstsc is not recognised – SteveM – 2018-07-19T03:53:58.947
It is not a built-in command. You need to download the Connect-Mstsc.ps1 script file from the link I mentioned. Then cd to the script file location (
cd C:\Users\Yisroel\Downloads
) then run. .\Connect-Mstsc.ps1
and then that script with the details – Yisroel Tech – 2018-07-19T04:10:52.883Yisroel, still not working sorry. Downloaded script, and ran as above. Error: " ...cannot be loaded because running scripts is disabled". Ran as admin: "Set-ExecutionPolicy -executionpolicy undefined". Still getting error – SteveM – 2018-07-19T04:46:48.787
1To run a script from anywhere you need to first run
Set-ExecutionPolicy Unrestricted
– Yisroel Tech – 2018-07-19T04:55:01.530