Running Ranorex Script on remote desktop connection

Ask general questions here.
KimVW
Posts: 6
Joined: Mon Feb 01, 2021 1:06 pm

Running Ranorex Script on remote desktop connection

Post by KimVW » Wed May 26, 2021 3:30 pm

Well I have a question here.

In a RDP session I have created a Ranorex script to turn off a virtual machine and turn it on again, let's say after 2 minutes. When running the script manually (hitting that run button) in Ranorex studio everything is going well... .

While the RDP session is active I can run the script perfectly (by hitting the run button in studio, by executing the executable via commandline or even by executing the script through a scheduled task). What we want to do, is running the script by a scheduled task outside business hours. When I schedule a task to run the script and minimize (or even log off my RDP session) the script is started but fails almost instantly.

Already tried the below solution but without succes.

https://www.ranorex.com/help/latest/ran ... lRDPbrspan

Any idea's how I can get this to work? Preferably without using a build pipeline like jenkins or teamcity.

thanks!
Kim

User avatar
doke
Posts: 112
Joined: Fri Mar 29, 2019 2:33 pm

Re: Running Ranorex Script on remote desktop connection

Post by doke » Thu May 27, 2021 10:32 am

try ending your rdp session with this script , instead of close button:

for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
%windir%\System32\tscon.exe %%s /dest:console
)

ranorex normaly interacts with the gui. without a (rdp) session you have no gui. the script "moves" your session to the console (session) , which will stay active.
scheduled task has same problem=> you dont have a session, so no gui interaction.

Does your ranorex recording need the gui ?

KimVW
Posts: 6
Joined: Mon Feb 01, 2021 1:06 pm

Re: Running Ranorex Script on remote desktop connection

Post by KimVW » Thu Sep 16, 2021 3:20 pm

That did the trick! Thanks!