How to access GUI of a Windows application run by task scheduler under a specific domain user?
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 e开发者_JAVA百科ven 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?
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".
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.
精彩评论