Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Send Click and Keys to RDP session

$
0
0

I am trying to automate to RDP a computer and start a program. I am trying it with WASP from www codeplex

Ideally my aim is to -

RDP to a server and Click OK to Legal Notice window

Click on start menu > Run > Enter key

Type a command in run prompt and then send enter key

Here Stuck in sending keys to RDP session. Can anyone help me to make it work? If it’s not possible via PowerShell then what are my other options?

This is what I have so far..

$process = Start-Process -FilePath mstsc -PassThru
Start-Sleep -Seconds 2
$mstsc = Select-Window | Where-Object { $_.ProcessID -eq $process.Id }
$mstsc | Send-Keys Server.domain.com~

#Sleep to enter password
Sleep -Seconds 15

#Send enter key fails here
$mstsc | Send-Keys ~


Viewing all articles
Browse latest Browse all 6937

Latest Images

Trending Articles



Latest Images