How to force a started program's tray icon to appear from a scheduled task set to run whether the user is logged on or not?

Himanshu Vaishnav 0 Reputation points
2023-05-26T05:11:05.9533333+00:00

I am facing an issue, when a scheduled task is set to run regardless of user login status, the program is running successfully showing in the "Task Manager", but its associated tray icon fails to appear.

The lack of a visible tray icon impedes users' ability to interact with the program, monitor its status, and receive essential notifications, ultimately hindering their productivity and efficiency.

So I tried using a power shell script that invokes the UI with process id but this script is only working for Microsoft products like - excel, notepad, etc.

I am finding a solution that guarantees the visibility of a started program's tray icon from a scheduled task when the user login into the system.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,604 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 42,876 Reputation points
    2023-05-26T07:07:08.7033333+00:00

    @Himanshu Vaishnav, When a scheduled task is configured to run when the related user account is not logged on then it is executed in non-interactive session 0. The process started by such a task runs in session 0 and does not have direct access to the desktop of any logged on user and cannot display a user interface.

    The commonly implemented solution is to also start a process that runs in the logged-on user's interactive session. This "helper" process can provide an icon in the notification area (tray icon) and use an Interprocess communication method to communicate with the related process running in session 0 to display notifications, etc.