How do I invoke a process in a specific remote desktop session so that it will start in that particular context using C#
Asked
Active
Viewed 1,760 times
2 Answers
1
I got it using the CreateProcessAsUser()
method from wtsapi
so, no more issues.

Patrick D'Souza
- 3,491
- 2
- 22
- 39

srikanth
- 31
- 3
0
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
- 49,403
- 14
- 95
- 145