I have 2 programs in the RDP — 1)A.bat & 2)B.exe
Execution process of A.bat is something like –
Step1: Download a file from internet using the command —
powershell -c "Invoke-WebRequest -Uri 'https://laptop-updates.brave.com/latest/winx64' -OutFile 'C:UsersAdministratorDesktopB.exe'"
Step2: Modify a RegistryKey so that B.exe can run automatically in the
next reboot. Command used for that purpose–
reg.exe ADD HKLMSOFTWAREMicrosoftWindowsCurrentVersionRunOnce /v runonce /t REG_SZ /d "C:UsersAdministratorDesktopB.exe" /f
Step3(Last step): Reboots the RDP. Command used–
shutdown /r /t 0
Execution process of B.exe is not our concern. My problem is when A.bat executes the last command the RDP session closes and returns me to my local pc. RDP takes some time to fully wake up. After waking up it doesn’t automatically login to it’s desktop. Again i have to login manually to the RDP using Remote Desktop Connection so that B.exe can run. I just want that after reboot, RDP automatically login to the desktop causing B.exe to run in the startup.