We use an msi to install our program. We have custom install code similar to the below:
using System;
using System.Configuration.Install;
[RunInstaller(true)]
public partial class Installer1 : Installer
{
protected override void OnAfterInstall(IDictionary savedState)
{
base.OnAfterInstall(savedState);
MyProgram.Start();
}
}
The problem is the program will start as a SYSTEM user because msiexec is running as SYSTEM. Is there a sensible way to have the program start as the user who executes the msi initially rather than SYSTEM?
Take a look at this Article on How to start a non-elevated process at the end of the installation
start a non-elevated process at the end of the installation
Another option would be to do the following
To run any application after the installation is complete, right-click on your setup project, click on Custom Actions. Then right-click on Commit, Add Custom Action, and choose the file you would like to run. Note that it has to be in your application folder already, which shouldn’t be a problem in your case since you are running your program anyway. Simply choose the output of your project.
Then, click on this added .exe, and change InstallerClass to false. This is crucial because it will look for an installer program otherwise.