title: Custom action with elevated privileges to run batch file
body: <p>I need to launch .cmd script during installation, and this script modify some files in the installation directory.
  I have the following WiX code:</p>
  
  <pre><code>&lt;Fragment&gt;
      &lt;Property Id="WINCMD"&gt;cmd.exe&lt;/Property&gt;
      &lt;CustomAction Id="ResignManifest" 
                    Property="WINCMD" ExeCommand="/C [ToolDir]manifest_resign.cmd"
                    Execute="deferred" Impersonate="no" Return="check"/&gt;
  
      &lt;InstallExecuteSequence&gt;
          &lt;Custom Action="ResignManifest" After="InstallFinalize"/&gt;
      &lt;/InstallExecuteSequence&gt;
  &lt;/Fragment&gt;
  </code></pre>
  
  <p>The problem is that <strong>during installation the script fails to do modification, because of insufficient access rigths</strong>. My <strong>CA specifies that MSI should not impersonate the user context</strong> (I launch installer with Admin rigths), but cmd.exe runs without Admin rights.</p>
  
  <p><strong>PS</strong>. I know that this isn't good practice to additionally launch bat/cmd files during installation, but I have to do it to resign application and deployment manifests for some Silverlight application (during installation user modifies application config file, so the hash of such file inside manifest become invalid).</p>