Keepass configuration
Go to: Menu > Tools > Options > Integration > URL Overrides
The cmd:// prefix run the “URL” as a Windows command.
Add:
cmd://cmd /c "cmdkey /generic:TERMSRV/{URL:RMVSCM} /user:{USERNAME} /pass:{PASSWORD} && mstsc /v:{URL:RMVSCM} /f && timeout /t 5 /nobreak && cmdkey /delete:TERMSRV/{URL:RMVSCM}"
where: