Run process under current user

alxndr picture alxndr · Feb 29, 2012 · Viewed 17.4k times · Source

There is "Setup project" in VS. During installation I launch another process:

System.Diagnostics.Process process = new System.Diagnostics.Process();
//fill StartInfo and run call Start()
process.Start();

If I run installer under Windows 7 and install for "Everyone", process start under the SYSTEM. If I install "Just for me", process start under Current user. How do I always start process under Current user?

Answer

alxndr picture alxndr · Mar 2, 2012

I have found very simple solution. All that you need it just create a new class and copy text from this link.

To launch the process call ProcessAsUser.Launch("program name");