Solved

Processes launched by WinService in different user session

Posted on 2011-03-09
9
351 Views
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.
0
Comment
Question by:brenlex
  • 6
  • 3
9 Comments
 

Author Comment

by:brenlex
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 question...is there an alternative (in code) to ticking the "Allow service to interact with desktop”?
0
 
LVL 5

Accepted Solution

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

Author Comment

by:brenlex
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?
0
 
LVL 5

Expert Comment

by:MedievalWarrior
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.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:brenlex
ID: 35213939
Is this also the case for XP SP3 ?
0
 
LVL 5

Expert Comment

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

Author Comment

by:brenlex
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

Thanks.
0
 

Author Comment

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

Author Closing Comment

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

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now