title: WiX: make symbolic link with UAC enabled
body: <p>I want to execute a custom action in a Windows Installer (with WiX script) that makes symbolic links at the end of installation. mklink requires administrator privilege, as the installer restricts. This is what I wrote:</p>
  
  <pre><code>&lt;CustomAction Id="mklink_cmdline" Property="QtExecCmdLine" Value='"[SystemFolder]cmd.exe" /c mklink "[SystemFolder]my_app.dll" "[INSTALLDIR]my_app.dll"' /&gt;
  &lt;CustomAction Id="mklink_exec" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="ignore" /&gt;
  
  ...
  
  &lt;InstallExecuteSequence&gt;
      &lt;Custom Action="mklink_cmdline" Before="InstallFinalize"&gt;
          ...
      &lt;/Custom&gt;
      &lt;Custom Action="mklink_exec" After="mklink_cmdline"&gt;
          ...
      &lt;/Custom&gt;
      ...
  &lt;/InstallExecuteSequence&gt;
  </code></pre>
  
  <p>This works perfectly if UAC is completely disabled. However, when enabling UAC in any level, this custom action fails with </p>
  
  <pre><code>CAQuietExec:  You do not have sufficient privilege to perform this operation.
  </code></pre>
  
  <p>even if I allowed in the consent window. I tried to change Execute to deferred, Impersonate to no, or change package's InstallPrivileges to elevated, none of them works.</p>
  
  <p>Any suggestion I can bypass? Thank you!</p>
  
  <p><strong>Edit</strong>: revised code with deferred custom action</p>
  
  <pre><code>&lt;CustomAction Id="mklink_cmdline" Property="mklink_exec" Value='"[SystemFolder]cmd.exe" /c mklink "[SystemFolder]my_app.dll" "[INSTALLDIR]my_app.dll"' /&gt;
  &lt;CustomAction Id="mklink_exec" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Impersonate="no" Return="ignore" /&gt;
  
  ...
  
  &lt;InstallExecuteSequence&gt;
      &lt;Custom Action="mklink_exec" Before="InstallFinalize"&gt;
          ...
      &lt;/Custom&gt;
      &lt;Custom Action="mklink_cmdline" Before="mklink_exec"&gt;
          ...
      &lt;/Custom&gt;
      ...
  &lt;/InstallExecuteSequence&gt;
  </code></pre>