Processes launched by WinService in different user session

Posted on 2011-03-09
Last Modified: 2012-05-11
I have a Windows 'monitoring' Service written in C# which is intermittently required to relaunch executables.  

I am using a Process.Start(myProcessStartInfoObj) 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.
Question by:brenlex
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3

Author Comment

ID: 35082772
I've come across the option to tick "Allow service to interact with desktop” under the LogOn tab of the Services properties window, though this is not recommended by various online sources.

Therefore addendum to my initial there an alternative (in code) to ticking the "Allow service to interact with desktop”?

Accepted Solution

MedievalWarrior earned 500 total points
ID: 35082839
See this thread http:Q_26726314.html

Author Comment

ID: 35083813
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?
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 35083854
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.

Author Comment

ID: 35213939
Is this also the case for XP SP3 ?

Expert Comment

ID: 35214007
Interactive services work in XP but are not supported on Vista or later.

Author Comment

ID: 35236433
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


Author Comment

ID: 35239855
Resolved with a C# adaption of a very useful code snippet at Q_26726314.

Author Closing Comment

ID: 35239864
Thanks for the link.  For info, during my testing I discovered that XP SP3 also does not support Interactive Services.

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question