login to remote using "mstsc /admin" with password

Sandy picture Sandy · Jan 23, 2013 · Viewed 134.7k times · Source

I want to use mstsc /admin to login to a server silently. My batch file reads the code as

mstsc /v:xxx.xxx.xxx.xxx /admin

But it ask me to enter password. Can anyone help me to skip this step?

I went on to Google and found this site. But I am very new to this stuff (scripting) and could not understand what to do with given code. Is it a vbscript file? Can I do the same thing with a batch file. Please elaborate and I request you to spoon feed. This is not my arena but still I am pushed to fight without weapons.

My basic need is to kick off all users from a remote desktop except mine to perform some maintainable work. Thanks.

Answer

Angelo picture Angelo · Dec 5, 2014

Re-posted as an answer: Found an alternative (Tested in Win8):

cmdkey /generic:"<server>" /user:"<user>" /pass:"<pass>"

Run that and if you run:

mstsc /v:<server>

You should not get an authentication prompt.