I have a service that runs and accepts remote commands. I am trying to send a remote command to uninstall. This works and executes the msiexec. The msiexec gets to the point where it tries to stop the service and then hangs and eventually fails saying no privileges to stop the service.
If I run the same command from a command window it works fine.
I have tried this running the service as local system (with admin privs) as well as administrator (I enabled the administrator account)
I just can't seem to figure out why I am getting permission errors stopping the service running the msiexec
added information
- We have a single service - it does required work and sleeps periodically
- the service typically runs as local system
- we have the installer set using custom actions - and all cases work fine - installing and uninstalling from command line - but running msiexec uninstaller initiated within the C# code has this issue
- When a remote request is made to uninstall the desire is to remove the service, registry entries, and files on disk
- The request is handled by the running service - it goes to the registry, finds the product entry and retrieves the uninstall command
- when the uninstall is performed I use C# process and include in the StartInfo parameters the program name, arguments, and verb (defined as run as) - among other parameters
- the uninstaller starts properly, does some actions, and then gets to the point of stopping the service
- stopping the service sits until it times out after which it writes in the uninstall log that there may not be sufficient privileges to stop the service