Click here to Skip to main content
15,894,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Windows services run in session 0, i have a code that i need to run as a user in session 1
from the windows services. Please feel free to guide as i am new on this.
Posted
Updated 1-Apr-13 21:01pm
v3

Analyse the requirements again. Do you really need to run "code" of the service from a user session? Surely not.
You need an application running in the context of the user which communicates with the service by e.g. .Net Remoting (old) or WCF, ...
 
Share this answer
 
Comments
muneebalikiyani 28-Mar-13 5:02am    
Yes, your are right on that i want to run "code" of service from a user session.
Ian A Davidson 28-Mar-13 6:10am    
Voted 5. Having a user application that communicates with the service is the only solution I can think of as well. WCF seems to be the current standard, as you mentioned.
You can't do that. It's considered a security risk and Microsoft has taken steps to prevent you from doing what you want to do.
 
Share this answer
 
1) Goooooooggggggggllllleeeeeee!!!!!!
2) Have a look here: Subverting Vista UAC in Both 32 and 64 bit Architectures[^]
3) you can even call psexec with proper parameters if you don't want to bother yourself with the windows api
 
Share this answer
 
v2
Comments
muneebalikiyani 28-Mar-13 3:51am    
It requires an .exe file to run from service , i want to run code (not a program ) from windows service.
Zoltán Zörgő 28-Mar-13 5:21am    
You wrote yourself, even if you deleted it: that you want to run a "user created process".
You can not spit a process between sessions. Forget it. A process is bound to a session. As I suggested, you can start only a process in a session. Or you can change authentication context a thread, bot not the session. But it makes no sense not to build a separate executable for that task since you can have several kind of IPC to communicate with your service.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900