Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running msiexec from a service (Local System account)

We are working on an update system for our software. The updater should run in the background as a service, and when an update is available, download and install it. We need the service to install the update since the MSI requires elevation to run, but some of our clients will be restricted users.

The MSI is a WiX MSI and does a major upgrade when run. The problem is, the update does not seem to work when run from our service. I can see msiexec run, and it returns successfully, but it seems to make no changes to the system. The same command, when run from my user account works as expected.

Is there some caveat to running msiexec from a Local System service?

We are simply doing:

string arguments = "/i /quiet /lv*x " + pathToLogFile;   
System.Diagnostics.Process.Start("msiexec.exe", arguments);
like image 849
Jarrod Avatar asked Apr 08 '10 22:04

Jarrod


People also ask

Can you use msiexec with exe?

msiexec can open only . msi packages. Even if your setup.exe contains . msi package you won't be able to run it this way.


1 Answers

If your service is a Windows service then do the following steps:

  1. Open properties of your service in Services console.

  2. Go to the Log On tab

  3. Set an account that has rights to update the system (yours or specially created for this purpose)

  4. Restart the service

In this case, the service will be run with proper rights and can do updates.

like image 117
Andrey Tagaew Avatar answered Sep 28 '22 00:09

Andrey Tagaew