3

I'm having trouble creating a Powershell script that will open an RDP session without a prompt asking for a password.

I've followed the instructions in the following post, however the password prompt always pops up.

Here is the script:

cmdkey /generic:"server ip" /user:"username" /pass:"password"
mstsc /v:"server ip"

Does anyone know what I'm doing wrong? Is it possible to execute within the realm of Powershell? Thanks!

4
  • are you using a domain user or local user to connect to the computer Commented Sep 22, 2021 at 15:23
  • Im using a local user Commented Sep 22, 2021 at 16:05
  • try using ".\username" your script worked for me Commented Sep 22, 2021 at 16:33
  • Alright, Ill try it tomorrow at work. Thanks! Commented Sep 22, 2021 at 17:19

1 Answer 1

2

So I figured it out with Bonneau21's help (thanks!):

I'm connecting to a computer that isn't part of a domain, because of that I need to connect with a local user.

What I did was a slight change to the original script indicating that the user I need to connect with is local:

cmdkey /generic:"server ip" /user:"server ip\username" /pass:"password"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.