Troubleshooting Guide: Desktop Disconnected While Performing UI Actions

How to solve error "Desktop has been disconnected while performing UI actions" ?

Issue Description

While executing an automation, the Robot encounters error: "Desktop has been disconnected while performing UI actions".

Resolution

  1. Ensure best practices are followed for Unattended Robots.

    • For Unattended bots, the Robot should be logged out before starting an automation. If logged out before an automation starts, the Robot will log out when it is finished. This practice often prevents the issue.

    • If logged into a Windows machine while the Robot is executing in Unattended mode, stay logged in for the remainder of the automation.

      • If logged in via RDP and disconnected while it is executing, the Windows machine will detect that event and put the GUI into a 'Disconnected state'. The VM does this to save resources.

      • A 'Disconnected State' is a state a Windows session is put into, when a user disconnects from an RDP session. In this state, processes still exist but the GUI is no longer active or rendered.

    • If the Robot is started from the Robot tray, the rules for Attended Robots apply. See the next section.

  2. Ensure best practices are being followed for Attended bots

    • If the Robot is Attended, stay logged in while it executes. If disconnected while the Robot is executing, it will cause this issue.

    • If the Robot is Attended and being run in an RDP session and the screen is minimized, it can cause this issue. The Windows machine will detect that the screen has been minimized and stop rendering the GUI. This behavior can be disabled. Read more at Executing Tasks in Minimized RDP Window.

  3. If the issue can be reproduced and occurs on a Windows Server (this won't work for a workstation), try the following:

    • Wait for the issue to occur

    • RDP to the Robot machine as a different user (a Windows server by default allows two users to be logged in at once)

    • Open Task Manager

    • Go to the Users tab

    • For the Robot's session, check the status column. If it says disconnected, that explains the issue. See the note on the first step.

  4. If the issue occurs after a set time, check the group policy for screensaver settings or RDP settings that put the machine in a disconnected state after a set period.

    • Open a command prompt

    • Run the following command: gpresult /h %temp%/gpresults.html

    • Go the the %temp% folder (just input that in the navigation bar of File Explorer) and open the gpresults.html file.

    • Search for any screensaver or RDP policies.

      1. For RDP (under Computer Configuration->Administrative Templates->Windows Components->Remote Desktop Services->Remote Session Host->Session Time Limits)

        • Set a time limit for active but idle Remote Desktop Services session

        • Set time limit for active Remote Desktop Services sessions

      2. For screensaver (under User Configuration -> Administrative Templates -> Control Panel ->Personalization)

        • Screen Saver Timeout

The above list is not exhaustive but the most common problems.

  1. If the Robot is Unattended, ensure that it is installed and in service mode and being started from Orchestrator

    • Open Services.msc

    • Find the UiPath Robot service. If it does not exist the Robot is not installed in service mode. This means that the only way it can be started is from the Robot tray, or if a user RDP'd into the machine as the Robot user and disconnected, it can be started from Orchestrator. This should never be done.

    • To fix this:

      • Go to Add/Remove programs

      • Find UiPath Studio

      • Select Modify

      • And the next menu's, make sure to enable service mode.

  2. If the above steps do not help, try using the Robot Streaming tool or the Orchestrator recording feature to watch the issue while it occurs:

  3. Another good practice is to make sure the GUI is visible on the screen. Use the Maximize Window activity if necessary.

1 Like