Common issues with local desktop rendering

Updated at:

This article explains how to solve common issues when using the Local mode for Desktop Rendering.

Configure console session resolution

This section explains how to set and verify the default resolution on an ECS instance.

Set default resolution in the registry

Important

This is an optional solution and may not work in all scenarios.

  1. Press Win+R or open a command line tool, and then enter regedit.

  2. In the Windows registry, navigate to the following path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration\MSBDD_NOEDID_1234_1111_00000000_00020000_00^E3701873EC28AFCFF631E725354CDC2D\00

    image

  3. The default values for PrimSurfSize.cx and PrimSurfSize.cy are 1024 and 768.

  4. For example, to change the resolution to 1280x1024, set PrimSurfSize.cx to 1280 and PrimSurfSize.cy to 1024. Make sure to select Decimal when you modify the values, as shown in the following figure.

    image

Verify console session resolution and scaling

Note

You cannot directly view settings, such as resolution, for a process running in a Windows console session on a virtual machine. Use an RPA application to retrieve this information.

  1. In code editing mode, use the following project code and publish it as an RPA application (for example, get_current_resolution_dpi).

    from rpa.core import *
    from rpa.utils import *
    import rpa4 as rpa 
    import win32gui
    import win32print
    import subprocess
    
    
    def start():
        # Query the current session type
        r = subprocess.run("query user",capture_output=True,encoding="gbk")
        rpa.console.logger.info(r.stdout)
        
        # Query the current resolution and scaling
        horzres = win32print.GetDeviceCaps(win32gui.GetDC(0), 8)   
        vertres = win32print.GetDeviceCaps(win32gui.GetDC(0), 10)  
        dpi = win32print.GetDeviceCaps(win32gui.GetDC(0), 88)
        rpa.console.logger.info("Resolution:{}/{}  DPI:{} Scale:{}%".format(horzres,vertres,dpi,round(dpi/96*100)))
  2. Install and log in to the client on the virtual machine, and ensure the client is available for scheduling.

  3. In the console, navigate to Client > Robot Monitoring and set Desktop Rendering to Local for the robot. For more information, see Local.

  4. In the console, navigate to Client > Scheduled Task Management > Timed Tasks, create a timed task with the following key settings:

    Parameter

    Setting

    Application to run

    Select get_current_resolution_dpi.

    Robot

    Select the robot and enable "Desktop Rendering", as shown in the figure.

    image

    Schedule

    Select "Run immediately".

  5. After the task is complete, view the resolution and scaling of the console session in the task's run log.

    image

Set permissions for console session switching

Important

We recommend running the robot as an administrator user. If you do so, you can skip this section.

Note

This section explains how to configure permissions and troubleshoot issues for non-administrator users.

Set Windows user permissions

  1. Check the current Windows user.

    1. Press Win+R or open a command line tool, and then enter compmgmt.msc.

    2. In the left navigation pane, expand System Tools > Local Users and Groups > Groups.

    3. Double-click Administrators or right-click it and select Properties. In the window that appears, verify that the current Windows user is in the member list.

      image

  2. If the current Windows user is not in the Administrators group, you must add the user.

    Important

    An administrator user must perform this step.

    1. Press Win+R or open a command line tool, and then enter compmgmt.msc.

    2. In the left navigation pane, navigate to System Tools > Local Users and Groups > Groups. Double-click Administrators or right-click it and select Properties. In the window that appears, add the intended user.

      image

  3. Set registry information.

    Important

    An administrator user must perform this step.

    1. Press Win+R or open a command line tool, and then enter regedit.

    2. Check the FilterAdministratorToken key at Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System and ensure its value is set to 0.

  4. Disable the confirmation prompt for session switching.

    Important

    An administrator user must perform this step.

    1. Press Win+R or open a command line tool, and then enter compmgmt.msc.

    2. In the left navigation pane, navigate to Local Policies > Security Options. Change the setting for "User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode" to "Elevate without prompting".

      image

  5. If the intended user is already logged in, you must log out and then log back in for the changes to take effect.

Troubleshoot session switching failures

console session switching failures are primarily caused by insufficient Windows user permissions. This section explains how to diagnose and resolve the issue.

Analyze the problem

  1. First, confirm that your automation process requires desktop rendering. Then, verify that the process fails with errors like "control search timeout" when run unattended, for example, through a timed task or an API call.

  2. In the console, on the Client > Robot Monitoring page, verify that the robot is not running in a console session. For more information, see Local.

  3. Analyze the logs of the client. For instructions on how to find the logs, see Obtain all client logs. In the latest Robot.log file, if you find error messages similar to the following, it indicates a permission issue.

    [Error] Execute tscon command failed: System.InvalidOperationException: Execute tscon command error: Cannot connect sessionID 2 to sessionname console, error code 5
    Error[5]:Access is denied.
    [Warn] Switch to console failed: Cannot connect sessionID 2 to sessionname console, error code 5
    Error[5]:Access is denied.
    [Info] Current user cannot do switch to console action directly.

Solution