brenlex
asked on
Processes launched by WinService in different user session
I have a Windows 'monitoring' Service written in C# which is intermittently required to relaunch executables.
I am using a Process.Start(myProcessSta rtInfoObj) with passed arguments which works fine with regard to actually starting the processes, however the problem I am experiencing is that the processes' icons do not appear on the task bar and...
(1) the processes are not shown by default in Win 7 (whereby the relaunched processes are launched under a different session (SYSTEM) rather than under the logged-in user (admin) account).
(2) the applications do not appear in Task Mgr on Win XP.
If I make exactly the same method call from a WinForm app, the icons appear in the taskbar OK, and the processes appear in Task Mgr OK too (on both flavours of OS).
I have tried changing the 'Logon' params associated with the Service from Local System Account to 'This account' with no success.
Do I need to specify some additional info in myprocessStartInfoObj param to get around this (and get my icons and TaksMgr applications displayed)?
Thanks for any advice.
I am using a Process.Start(myProcessSta
(1) the processes are not shown by default in Win 7 (whereby the relaunched processes are launched under a different session (SYSTEM) rather than under the logged-in user (admin) account).
(2) the applications do not appear in Task Mgr on Win XP.
If I make exactly the same method call from a WinForm app, the icons appear in the taskbar OK, and the processes appear in Task Mgr OK too (on both flavours of OS).
I have tried changing the 'Logon' params associated with the Service from Local System Account to 'This account' with no success.
Do I need to specify some additional info in myprocessStartInfoObj param to get around this (and get my icons and TaksMgr applications displayed)?
Thanks for any advice.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'd prefer a managed code solution really, rather than using interop, if indeed there is one. If not, I am happy to stick with the checkbox on the Service's properties.
Only problem is the checkbox approach works OK on XP, but fails (process runs OK but no icon/listing in TaskMgr Applcations page) on Win 7 !
Any ideas?
Only problem is the checkbox approach works OK on XP, but fails (process runs OK but no icon/listing in TaskMgr Applcations page) on Win 7 !
Any ideas?
There is no managed solution to what you want to accomplish. Thats because in Vista and later "Interactive Services" don't work. You have to use what is shown in the example.
ASKER
Is this also the case for XP SP3 ?
Interactive services work in XP but are not supported on Vista or later.
ASKER
Many thanks for your recommendations MedievalWarrior. The 500 points are yours, but I was hoping you might be able to shed some light on my follow-on issue raised in Q_26917602
Thanks.
Thanks.
ASKER
Resolved with a C# adaption of a very useful code snippet at Q_26726314.
ASKER
Thanks for the link. For info, during my testing I discovered that XP SP3 also does not support Interactive Services.
ASKER
Therefore addendum to my initial question...is there an alternative (in code) to ticking the "Allow service to interact with desktop”?