How to access GUI of a Windows application run by

2019-05-26 21:00发布

问题:

On our server running Windows Server 2008 R2 there is a scheduled task that runs a Windows application (.Net 4.0) under a specific domain user that performs some tasks and reports its progress in a listbox on a form that pops up by double clicking on a tray icon (right hand side of the task bar).

I understand that if I logon to the server (I can only remote desktop to the server) with a different user other than the one the scheduled task runs the application under I would not be able to see any user interface of the application but the problem is even if I remote desktop with the same login as that of the scheduled task I cannot see the tray icon and consequently the application user interface.

I wonder where this limitation comes from and how I could make is possible to see the application UI. Any idea please?

回答1:

I don't see that this is a limitation, it's part of the security design of the system.

One common way to handle such a scenario would be as follows:

  • Implement the main task as a service.
  • Implement a small UI program that presents an icon in the notification area (the tray).
  • Communicate between the UI and the service over a named pipe, TCP/IP or some other communication mechanism.

If you do it this way then it is quite possible to run the UI on a different computer which sounds like it might make life easier for you.



回答2:

Possibly when you remote to the server you are not using the /admin switch which will present the console view (where presumbly your app is running) rather than the "2nd session".