Could you run a background process from a foreground process?

One of my biggest limitations with the background process is that when you run one from Orchestrator, it must run in Session 0, which can be very limiting when it comes to permissions and there are other issues which arise.

Could you theoretically create a foreground process which logs into the user session and runs multiple background processes in parallel, therefore bypassing the issues of session 0 and running the processes as the actual user?

— Edit —
It seems to be possible but there are a number of issues with the practicality -
The foreground process is taking the UI runtime slot so there is no immediate benefit. You could still benefit by:

  1. Using a UI bot to run multiple background processes at once. Problems:
    a. No control to pause/stop the background processes from Orchestrator
    b. Difficult to manage which background processes are being run without editing the UI process
    c. Potential security concern if built incorrectly - potential to execute code from Orchestrator
  2. Using a UI bot to start a long background process and end the UI process while the background process continues to run, freeing up the UI runtime.
1 Like

@matt.theisen

Yes, you can create a foreground process that logs into the user session and runs multiple background processes in parallel to bypass Session 0 limitations and execute processes as the actual user.

cheers…!

@matt.theisen

Yes, you can run a background process from a foreground process using task scheduling or subprocess creation.

cheers…!

@matt.theisen

Running a foreground process that logs into a user session and executes background processes can raise security concerns. If the foreground process is not properly secured, it may allow unauthorized access to the user’s session. Additionally, the foreground process would need to interact with the user’s desktop, which may not always be desirable or secure.

Cheers…!

Yes, it is theoretically possible to create a foreground process in UiPath that logs into the user session and runs multiple background processes in parallel. This would bypass the issues of Session 0 and allow the processes to run as the actual user.

To do this, you would need to create a foreground process that performs the following steps

  1. Logs in to the user session using the Log On to Computer activity.
  2. Starts the background processes using the Start Process activity.
  3. Monitors the status of the background processes using the Get Process Status activity.
  4. Kills the background processes if they fail using the Kill Process activity.
  5. Logs out of the user session using the Log Off from Computer activity.

You can use the Loop activity to repeat steps 2-4 for each background process that you want to run.

Here is a diagram of a sample foreground process that logs into the user session and runs multiple background processes in parallel:

[Start]
Log On to Computer
Loop
    Start Process
    Get Process Status
    If process failed
        Kill Process
    End If
End Loop
Log Off from Computer
[End]

You can also use the Invoke Process activity to start a background process from a foreground process. This can be useful if you need to pass parameters to the background process or if you need to capture the output of the background process.

Here is a diagram of a sample foreground process that uses the Invoke Process activity to start a background process:

[Start]
Log On to Computer
Invoke Process
    Process name: BackgroundProcess.exe
    Arguments: parameter1, parameter2
    Capture output: Yes
End Invoke Process
Log Off from Computer
[End]

Once you have created your foreground process, you can deploy it to Orchestrator and run it as an unattended robot.

Check this out for reference

https://docs.uipath.com/robot/docs/background-process-automation

https://docs.uipath.com/activities/docs/invoke-process

Hope this helps

Cheers @matt.theisen

Is there something which makes this process less secure than a normal unattended robot as those would run on a user session?

Thanks for the comment!

Well more than securely it’s about the performance of the bot which will be really good when this scenario is handled with unattended bot
@matt.theisen

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.