I am getting the error Cannot bring the target application in the foreground because the Windows session is locked. while running the code from the orchestrator in unattended mode. However all the activities are working fine before the Ui Interaction.
And other processes are also running fine on the same VM because they are not using the Ui Automation.
Then your robot is installed in usermode…you would see uipathuserhost.exe that means it cannot run ui automation in background or u attended…so please reinstall the robot in service mode