I would like to have a PowerShell script that can start a RD section for a VM that I have on Azure, without the need for a real person to enter the credentials.
I'm not concerned with security. It needs only to be automatic, there is no problem if we have the user and password as plain text.
Using Get-AzureRMRemoteDesktopFile
I can get the file or use -Launch
to start with only one line. I also considered mstsc .\machine.rdp
and edit the file following a similar very old question.
However on both cases I'm prompted with a user and password window.
My client and remote machines are both Windows Server 2016.
If my understanding right, you could try to use the following command to RDP your VM automatic.
echo "Connecting to 23.98.218.139"
$Server="23.98.218.139"
$User="user"
$Password="********"
cmdkey /generic:TERMSRV/$Server /user:$User /pass:$Password
mstsc /v:$Server
Notes: When you first login your VM, you should trust your PC.