views:

311

answers:

2

How do I invoke a process in a specific remote desktop session so that it will start in that particular context using C#

A: 

Have you thought about using PsExec from SysInternals? This will allow you to run a process remotely, and if you specify the same credentials as the remotely logged in user then it will "run in their rdp session" as you put it.

If you cannot do that because you cannot supply the right credentials, then the only real options you have left are to do what regular sysadmins would do - e.g. run a batch or powershell file upon user login, or set up a scheduled task to run for that user.

slugster
A: 

I got it using CreateProcessAsUser() function from wtsapi so, no more issues

srikanth