Ilay
Ilay

Reputation: 51

RDP from Powershell command-line

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!

Upvotes: 3

Views: 4114

Answers (1)

Ilay
Ilay

Reputation: 51

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"

Upvotes: 2

Related Questions