I need to run a PowerShell script to shut down specific IIS App Pools during a WiX uninstall. The CustomAction is defined as this:
<SetProperty Id="RunStopScript"
Before ="RunStopScript"
Sequence="execute"
Value=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NonInteractive -ExecutionPolicy Bypass -InputFormat None -NoProfile -File "[INSTALLDIR]Scripts/StopAppPools.ps1"" />
<CustomAction Id="RunStopScript" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no" />
And scheduled like this:
<InstallExecuteSequence>
<Custom Action="RunStopScript" After='InstallInitialize'>REMOVE="ALL"</Custom>
</InstallExecuteSequence>
I modified the Script so that I can see immediately when they run, and the problem is when doing an uninstall I still get the prompt that files are in use and a reboot will be needed before the scripts are ran (this prompt only pops up if the App Pools the script stops are running). The idea behind the scripts is that users won't get this prompt when doing an uninstall or major upgrade.