Run a process from a windows service as the current user
<p>Morning All,</p>

<p>I currently have a windows service that is running under the System Account. My problem is that i need to start certain processes from within the service as the current logged on user. I have all the code etc to get the current logged on user / Active session.</p>

<p>My problem is that i need spawn a process as the logged on user but will not know the user credentials etc.</p>

<p>The service is .net compiled service and i expect that i need to use some Pinvoke methods to get a handle of one of the current users process in order to duplicate it and lunch as process with the handle.</p>

<p>Unfortunately i cannot find any good documentation / solution on how to implement it? </p>

<p>If someone is able to give me some guidance / example i would highly appreciate it.</p>

<p><strong>* Updated *</strong>
I think i have explained this incorrectly and need to reajust according to what i actually require. I do not necessarily want to launch a new process, i just want to impersonate the logged on user. I have been so wrapped up at looking at CreateProcess etc i have lead myself down a path of create a new process as the current logged in user (which is not particularly what i want to do). </p>

<p>In tern i just want to run some code under the current user context (Impersonate the current Logged on user)? </p>

<p>I do not know even if this is feasible?</p>

<p>** End of Update <em>*</em></p>

<p>Many thanks</p>

<p>Craig</p>
