title: Executing wix msi custom actions as system
body: <p>I am using WIX to build a an MSI that will be executed as a regular user but with system privileges (AlwaysInstallElevated=1).  I have defined two Custom Actions that execute net.exe.<br>
  The net.exe commands are not getting executed as a regular user.  I have also tested executing this msi as an Administrator and the net.exe commands are getting executed.<br>
  I have logged the msi output and I see error codes that lead me to believe that the net.exe commands are not being executed elevated.  I'm reaching out to the community to see if </p>
  
  <ol>
  <li>What I'm trying to do is possible  </li>
  <li>Do I need to instead use an exe as a custom action in order for the exe to install elevated.</li>
  </ol>
  
  <p>Thanks in advance for the feedback.</p>
  
  <pre><code>&lt;CustomAction Directory="TARGETDIR" ExeCommand="[SystemFolder]net.exe user TestUser /add" Return="ignore" Execute="deferred" HideTarget="no" Impersonate="no" Id="Command1"&gt;Command1&lt;/CustomAction&gt;
  &lt;CustomAction Directory="TARGETDIR" ExeCommand="[SystemFolder]net.exe localgroup Administrators TestUser /add" Return="ignore" Execute="deferred" HideTarget="no" Impersonate="no" Id="Command2"&gt;Command2&lt;/CustomAction&gt;
  &lt;InstallExecuteSequence&gt;
      &lt;Custom Action="Command1" After="PublishProduct"&gt;NOT Installed&lt;/Custom&gt;
      &lt;Custom Action="Command2" After="Command1"&gt;NOT Installed&lt;/Custom&gt;
  &lt;/InstallExecuteSequence&gt;
  </code></pre>
  
  <p>Machine Policy and User policy allows for msis to be executed as system.  </p>
  
  <pre><code>MSI (c) (DC:F8) [09:17:39:438]: Machine policy value 'AlwaysInstallElevated' is 1
  MSI (c) (DC:F8) [09:17:39:438]: User policy value 'AlwaysInstallElevated' is 1
  MSI (c) (DC:F8) [09:17:39:438]: Running product '{34ED8E61-40EA-47CE-95E7-8EE3CDBCB1E8}' with elevated privileges: All apps run elevated.
  </code></pre>
  
  <p>Errors</p>
  
  <pre><code>MSI (s) (8C:8C) [20:39:18:989]: Executing op: ActionStart(Name=Command1,,)
  MSI (s) (8C:8C) [20:39:18:989]: Executing op: CustomActionSchedule(Action=Command1,ActionType=3170,Source=C:\,Target=C:\WINDOWS\SysWOW64\net.exe user TestUser /add,)
  CustomAction Command1 returned actual error code 2 but will be translated to success due to continue marking
  MSI (s) (8C:8C) [20:39:19:535]: Executing op: ActionStart(Name=Command2,,)
  MSI (s) (8C:8C) [20:39:19:535]: Executing op: CustomActionSchedule(Action=Command2,ActionType=3170,Source=C:\,Target=C:\WINDOWS\SysWOW64\net.exe localgroup Administrators TestUser /add,)
  CustomAction Command2 returned actual error code 1 but will be translated to success due to continue marking
  </code></pre>