Robot seems to not find Virtual Desktop/Ui Elements when running fully unattended

Hi,

I know this topic has been asked several times but after hours of reading, I could not find any solution solving the issue for me.

My problem:
I have a rather simple workflow, reading and moving a few files and then performing some activities in an application. I run it as an unattended robot an a virtual machine. When I connect to the VM via remote desktop connection the workflow works fine, but when Im not connected the process fails as soon as a UI interaction is involved (so the renaming and moving the files still works, but the application does not start). I disconnect from the session, I dont just minimize the rdp window. I always start the robot via orchestrator (when im connected to the VM as well as when im not).

My errors:
I used to start the application via run prompt, which I opened with Send Hotkey Win+R, but this resulted in an error “Desktop has been disconnected while performing UI activities”. So I changed it to double clicking on the application icon, which resulted in “Click element. Timout reached.”

I tried to take a screenshot, but when I try to do this, the error says: “System.ComponentModel.Win32Exception (0x80004005): The handle is invalid”. Actually my workflow always takes a screenshot, when an error occures and while the error message is properly written in my error folder, the related screenshot is never saved. So taking screenshots seems to also not work, as long as I am not connected to the VM.

Tried solutions:

  1. I set login to console to false and the resoultion (height=768, width=1366 and depth=32) in the robot settings in orchestrator.
  2. Since this didnt work I set the same settings in UiPath.settings on the VM.
  3. I created a DWORD parameter in registry of the VM RemoteDesktop_SuppressWhenMinimized = 2 under HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Terminal Server Client and a DWORD parameter KeepAliveEnable = 1 under HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server
  4. I set both parameters also on my local machine connecting to the VM

My setup:
In case this makes a difference: I use Studio Pro Enterprise Edition 2020.10.0 and have a properly licensed unattended robot. The resolution settings mentioned above is exactly the resolution, which i use, when developing the robot. I develop on my local machine, but have access to another studio on the VM.

For me it just feels, as if the desktop is fully gone, as long as I am not connected to it. Any ideas highly welcome.

By the way: Via Screen.PrimaryScreen.Bounds I could actually confirm that the resolution is properly applied. So it must be something different preventing my code from accessing Ui Elements and taking screenshots.

Hi,

since nobody answered my question, I will answer it myself.

The reason is actually really simple to tell, if you take a look at my setup and the date I posted the question, because afaik the EE will be released in version 20.10.0 on next Monday. This means we installed the CE under the Enterprice License, which has one big difference to the EE: It always uses a User Mode robot, but for an unattended robot with UI interactions you need to use a Service Mode robot (exceptions might be possible). I myself find this fact not well enough documented, eventhough you can find it in the UiPath documentation (see here: https://docs.uipath.com/robot/docs/according-to-deployment and in my opinion the best explanation here: User Mode VS Service Mode), but its just not prominent enough for me.

I want to add, why we went for the CE eventhough we had the EE license in the first place. First, we obviously didnt know the difference in robot modes. Second, we couldnt get the connection to the Orchestrator having the UiRobot service registered as a Windows Service. This was only hard to fugure out, since we didnt know the service was differently registered. The reason was, that the service was going through the proxy as user service but not as a system service. There some good resources how to configure it to use the proxy though (see here: https://docs.uipath.com/robot/docs/redirecting-robots-through-a-proxy-server). We went with opening the firewall however.

I hope this helps someone with a similar problem. When I was researching it, I read a lot of solutions for the problem (including the ones mentioned in my question), but almost nobody pointed out the problem with the User Mode robot, eventhough some poeple clearly stated that they were using CE, which I find a bit odd. Instead I found those totally unrelated solutions as the ones I tried and some poeple explaining that in unattended mode you can only use simulated clicks and window messages (which might be true for CE). I only figured out that also normal clicks are no problem with EE, because I was researchching how to perform a double click with simulated clicks (thank you @johannes.kusber, see here: Problem with building an unattended bot with mouse actions).