3

I have script which uses mircrosoft's UIAutomation to automate an application. The script is inside a VPS running Windows Server 2012. The script works perfectly while I am connected to the VPS via Remote Desktop (RDP).

When I am not connected, the script seems to be stuck on SetFocus for a object... which leads me to believe that the script needs a Display/Screen/Session in order to work... but I am not sure if it is possible to do it while I am not connected to the VPS.

I can see 2 possible solutions here, either modify the script in someway to work in this environment or make the VPS have a virtual desktop while I am not connected (this solution might be more related to Server Fault rather than StackOverflow).

I am very confused, thanks for the help in advance :)

jww
  • 97,681
  • 90
  • 411
  • 885
TheDcoder
  • 509
  • 1
  • 7
  • 23
  • You should probably provide an MCVE. Also see [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – jww Feb 05 '19 at 07:00
  • 1
    I did not own the server or have administrative privillages at that time, and I was using an uncommon programming language via a library, so I was not sure about the raw calls to UIAutomation either. For those reasons I was unable to provide an MCV example. – TheDcoder Feb 06 '19 at 07:04

1 Answers1

2

I managed to workaround the issue by actually connecting to the server to itself (to 127.0.0.1) via RDP so that it will always have an active RDP session for the automation script to run.

I am not happy with the results but it works... I cannot give clear instructions on how you would need to modify the settings in Windows to allow RDP connections from self, it was a one big trial and error process, I have to modify some policies in the Group Policy Editor and then some stuff that I don't remember.

There is another downside to this, a Windows server will allow 2 simultaneous connections to it but by using this method we are reserving a slot so only 1 connection at a given time is possible, something to be aware of.

TheDcoder
  • 509
  • 1
  • 7
  • 23