[wix-users] Avoiding Files In Use and Reboot During Upgrade/Uninstall with WMI Provider
Bryan Dam
bryand at recastsoftware.com
Fri Aug 20 10:15:08 PDT 2021
We recently acquired some new software that I'm integrating into our installer that has a WMI provider. When the provider is called the WMI subsystem will load the provider DLLs and keep them in memory for a few minutes until they are unloaded. If we attempt an upgrade/uninstall when they are loaded Restart Manager dutifully does its thing:
>RESTART MANAGER: Detected that application with id 6188, friendly name 'WmiPrvSE.exe', of type RmCritical and status 1 holds file[s] in use.
So that's working as designed but this app is an agent that runs silent background without any user interaction. It will get deployed silently to 100s of thousands devices across our customers. They are not going to be receptive to taking a reboot for it. What's more, the company we acquired solved this problem by writing their own pre-elevate wrapper EXE that basically did all the real install/uninstall itself. Which is to say that the bar has already been set for never requiring a reboot though I'm not a fan of the wrapper solution.
Any ideas of how to handle this without a wrapper?
I tried writing a custom action that uses AssemblyInstaller to remove the WMIProvider assembly (WMI.NET requires them to have a class that derives from DefaultManagementInstaller) but I realized all too late of course that any kind of deferred action like that will happen after InstallValidate anyways.
There's the CloseApplication element but I can't indiscriminately kill 'WmiPrvSE.exe' since there could be several instances and I might even be sharing that instance with other providers.
Is there a way to add a wait time (unelevated) or run an elevated custom action before InstallValidate? Or maybe some other thing I haven't thought of.
Bryan
More information about the wix-users
mailing list