Automating the Remote Desktop Connection

194 views
Skip to first unread message

soumya nayak

unread,
Jul 26, 2020, 5:02:27 AM7/26/20
to Selenium Users

Hi All,

We have 11 physical lab machines. One of the machines is the master machine that is controlling the other 10 slave machines. So we have created one internal in house tool(web application)  which will trigger the selenium test from the master machine - doing RDP into all the 10 slave machines so that the test cases can run in all the 10 machines. All these 10 machines RDP is done from the master machine manually currently.


So i was trying to create a powershell script which i will place in the master machine and this inhouse tool will just invoke that powershell script and do automatic RDP into the 10 machines where i don't have to do manually anything.


So, the Master machine can be in locked state or signed out state, but still my script should work was my requirement.


But powershell script is failing when the machine is in locked or signed out state as the "sendKeys" is not working.


So any other way or tool if anybody can share, that would help me to automate the whole RDP process would be really great.


Regards,

Soumya

Jesús daniel Menéndez Roselló

unread,
Jul 29, 2020, 4:07:54 AM7/29/20
to seleniu...@googlegroups.com
Maybe Autoit is what you're looking for 
So did you explain that you couldn't send keys to virtual machine then you need something to open the windows and click in some position, so if you could send any pictures to explain better 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/213e7b04-eb80-440b-a41f-4d31ad83a201o%40googlegroups.com.

soumya nayak

unread,
Aug 4, 2020, 9:28:47 AM8/4/20
to Selenium Users
Hi Jesus,

i tried a powershell script as below 

[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
# Get the ID of the process
$WindowsHandle = Get-Process | Where-Object { $_.MainWindowTitle -Match 'Enter your credentials' } |Select-Object -ExpandProperty Id
# Activate the window
$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate($WindowsHandle) | Out-Null
mstsc /v:"<VM Name>" /admin
Start-Sleep -s 20
[System.Windows.Forms.SendKeys]::SendWait('<VM Password>')
Start-Sleep -s 15
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
Start-Sleep -s 15
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")

The above script works only when the windows is in active state but the script is failing in windows locked or signed out state. So i am looking for how to automate the RDP process from a machine which is in locked or signed out state.

Regards,
Soumya
To unsubscribe from this group and stop receiving emails from it, send an email to seleniu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages