I want to login to windows remote desktop via simple script which
- saves the password (so I do not see the prompt dialog asking for credentials)
- opens the remote desktop
I have written and save it as a .bat file:
cmdkey /generic:"Wk123" /user:"myLogin" /pass:"myPassword"
mstsc /v:Wk123
After I run it, the remote desktop opens without asking for credentials.
But If I save given script as .ps1 and run it in powershell, the login/pass dialogs opens and I am still beeing asked to enter the password. The dialog says: "The logon attempt failed".
Result from running the command is the same:
CMDKEY: Credential added successfully.
Why same commands work in a .bat file but does not in .ps1 ?