Semonit
Semonit

Reputation: 389

Stop/Delete LocalSystem Service on uninstall via Wix/MSI

As far as I understood by the answers of

is's quite prolematic to stop and uninstall a service when uninstalling the package if the service is started as LocalSystem.

Is there any possibility to achieve that? I can't imagine that this is not possible without forcing a File-In-Use dialog or the RestartManager-Popup.

Upvotes: 0

Views: 676

Answers (1)

PhilDW
PhilDW

Reputation: 20780

Neither of the topics you referred to are all that relevant. Stopping services is not often a problem, whether it's localsystem or not. There's really only one general reason that services don't stop when asked to: they're written poorly. They are just code, and if they don't respond to the stop request in a timely way then there's a problem. If they decide to take 20 minutes to shut down, to take an outrageous example, you can't blame the uninstaller. A service also may not stop properly if it's in one of those hosting processes so that some ordinary executable can run as a service, and I think that's the case with the java-type issues.

When there are files-in-use issues with services it can happen if they don't shut down, but also if they stop being a service but the process doesn't go away (which is often the case with the hosting-type services). A service can respond to the stop request and Windows will no longer treat it as a service, but there is no requirement for the process to go away - it can continue to run, do cleanup or whatever, so it will still result in files-in-use checks. It's also a common issue with Installer classes in Visual Studio setup projects (which don't use the standard MSI actions) because there is nothing to shut down a running service in those setups that use installer classes.

If you have a specific problem then you should post it, but stopping services is done all the time during uninstall with no issues.

Upvotes: 2

Related Questions