Search code examples
wixinstallationwindows-installercustom-action

My CustomAction is not working


I have the following CustomAction:

<CustomAction Id="CopyToSystem32" ExeCommand="[INSTALLFOLDER]copy.bat" 
              Directory="INSTALLFOLDER" Execute="deferred" Return="asyncWait" />

<InstallExecuteSequence>
  <Custom Action="CopyToSystem32" After="InstallFiles" >NOT Installed</Custom>
</InstallExecuteSequence>

The .bat itself tries to copy some files into System32 folder. But it's not copying them. The log says the following:

CustomAction CopyToSystem32 returned actual error code 1 (note this may not be 100% accurate if translation happened inside sandbox) MSI (s) (A4:DC) [15:58:46:812]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=313699) 1: CopyToSystem32 2: 1603

Why isn't my CustomAction working?


Solution

  • Try setting Impersonate to no on your custom action

    <CustomAction Id="CopyToSystem32" ExeCommand="[INSTALLFOLDER]copy.bat"
                  Directory="INSTALLFOLDER" Impersonate="no" Execute="deferred"
                  Return="asyncWait" />
    

    that will allow your deferred custom action to run with admin privileges.