Help Center

Starting a UI application from agent's script on Windows

Resilio Connect Agent runs as a service on Windows. This grants Agent ability to run even if no users are currently logged in. On the other hand, Windows OS has to run Agent process in a different session. As a result, all the UI applications launched by Agent inherit agent's session and are not visible to the end user despite the fact they have UI.

To launch a UI app by Agent, admin needs to explicitly push the application to currently active user session. This article describes how to do it with a Powershell script prepared by Resilio, Inc.

Getting the script to endpoint machine

Download script start-process-under-logged-on-user.ps1 from our public Git repository. Place it to a certain location on all your endpoint machines which require to launch UI apps, for example C:\Scripts\ folder. This can be done with a Distribution job or by any other means.

Launching your application with the script

The startup depends on how you start the script - using the built-in powershell script of the Management Console or launching with standard Windows command prompt.

  • If done via command prompt:
    powershell -ExecutionPolicy Bypass -Noprofile -File start-process-under-logged-on-user.ps1 -AppPath <path_to_your_app_with_exename>
  • If done via powershell, ensure that external unsigned scripts are allowed to run and then run it:
    Set-ExecutionPolicy -ExecutionPolicy Bypass -Force
    .\start-process-under-logged-on-user.ps1 -AppPath <path_to_your_app_with_exename>

Optional parameters

  • AppCmd <path>
    Allows to pass any parameters to the executable
  • WorkDir <path>
    Allows to set current working directory for the application
  • Wait
    Forces script to wait while started application exits. When not set, the script exits immediately, leaving UI process running.

Possible caveats

  • No active user sessions
    Which usually means no user is looking into the machine. The script will fail.
  • Several users are working on same computer in different sessions (usually can happen on Server platforms, supporting multiple users working simultaneously). The script will pick the user with lowest session ID (i.e. logged in earlier) to push app's UI there.
Was the article helpful? Yes / No, send feedback on article Thanks!

Please note that we won't mail you back. This is just purely feedback on the article above. If you need help from our Support Team, please use the "Contact Support" link at the top of the page.