Cannot Bring The Target Application In Foreground Because The Windows Session Is Locked

Error: "Cannot bring the target application in foreground because the Windows session is locked".

Issue: Robot receiving this error:

  • Cannot bring the target application in foreground because the Windows session is locked.

Resolution #1

Ensure Set time limit for active but idle Remote Desktop Services sessions policy is set to Not Configured or Disabled.

  1. Press Windows+R on your keyboard to open the “Run” window.
  2. Type gpedit.msc, and then hit Enter or click “OK.”
  3. Navigate to: Administrative Templates \ Windows components \ Remote desktop services \ Remote desktop session host \ Session Time Limits\ Set time limit for active but idle Remote Desktop Services sessions



Resolution #2

Ensure Enable news and interests on the taskbar policy is set to Not Configured or Disabled.

  1. Press Windows+R on your keyboard to open the “Run” window.
  2. Type gpedit.msc, and then hit Enter or click “OK.”
  3. Navigate to Computer Configuration > Administrative Templates > Windows Components > News and interests > Enable news and interests on the taskbar


Resolution #3

Ensure Sign-in and lock last interactive user automatically after a restart policy is set to Not Configured or Disabled.
  1. Press Windows+R on your keyboard to open the “Run” window.
  2. Type gpedit.msc, and then hit Enter or click “OK.”
  3. Computer Configuration > Administrative Templates > Windows Components > Windows Logon Options > Sign-in and lock last interactive user automatically after a restart

If the issue persists, then:
  1. Navigate to Administrative Templates \ Windows components \ Remote desktop services \ Remote desktop session host \ Connections
  2. Right-click Connections folder in left pane
  3. Select Export List...
  4. Save to .txt file.

Perform below steps also,

  1. Navigate to Administrative Templates \ Windows components \ Remote desktop services \ Remote desktop session host \ Session Time Limits
  2. Right-click Session Time Limits folder in left pane
  3. Select Export List...
  4. Save to .txt file.

Send the two .txt files to UiPath Product Support for further analysis.