title: WiX run PowerShell script in custom action before system file check
body: <p>I need to run a PowerShell script to shut down specific IIS App Pools during a WiX uninstall. The CustomAction is defined as this:</p>
  
  <pre><code>&lt;SetProperty Id="RunStopScript"
          Before ="RunStopScript"
          Sequence="execute"
          Value="&amp;quot;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe&amp;quot; -NonInteractive -ExecutionPolicy Bypass -InputFormat None -NoProfile -File &amp;quot;[INSTALLDIR]Scripts/StopAppPools.ps1&amp;quot;" /&gt;
  
  &lt;CustomAction Id="RunStopScript" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no" /&gt;
  </code></pre>
  
  <p>And scheduled like this:</p>
  
  <pre><code>&lt;InstallExecuteSequence&gt;
    &lt;Custom Action="RunStopScript" After='InstallInitialize'&gt;REMOVE="ALL"&lt;/Custom&gt;
  &lt;/InstallExecuteSequence&gt;
  </code></pre>
  
  <p>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.</p>