Search code examples
c#windows-installerrunas

Auto Launch application after Installation in default user (not in SYSTEM user)


I have created a Simple Windows Application, and its Installer too (Setup project).

Since I want to AutoLaunch the Application after Installation, I added this script in Installer.cs

public override void Commit(System.Collections.IDictionary savedState)
{
    string appPath = Context.Parameters["AssemblyPath"].ToString();
    System.Threading.Thread.Sleep(500);
    System.Diagnostics.Process.Start(appPath, "2");
}

Application Launches perfect, but it is running as SYSTEM user.

enter image description here

I want Auto Launched application to be run in the Default user which opens the MSI.


Solution

  • I got solution from this post

    Start a windows service and launch cmd

    This solves my problem of SYSTEM user