Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIX Create Scheduled Task

I am trying to create a scheduled task using WIX. I want the scheduled task to run as a specific user on another domain.

I pass in my user through a property [Service.User] and [Service.Password].

Here is my code:

<InstallExecuteSequence>
  <Custom Action="CreateScheduledTask" After="InstallFiles">NOT Installed</Custom>
  <Custom Action="CreateScheduledTaskId" After="CostFinalize">NOT Installed </Custom>
  <Custom Action="DeleteScheduledTaskId" After="CostFinalize">Installed</Custom>
  <Custom Action="DeleteScheduledTask" Before="RemoveFiles">Installed </Custom>
</InstallExecuteSequence>

<!--Create CcsReturnProcess Scheduled Task-->
<CustomAction Id="CreateScheduledTaskId"
               Property="CreateScheduledTask"
              Return="check"
              Execute="immediate"
               Value="&quot;[SystemFolder]SCHTASKS.EXE&quot; /CREATE /SC DAILY /MO 1 /ST 10:00 /TN &quot;CcsReturnProcess&quot; /TR &quot;&quot;[INSTALLFOLDER]CcsReturnProcess.exe&quot;&quot; /RU &quot;[Service.User]&quot; /RP &quot;[Service.Password]&quot; /RL HIGHEST" />

<CustomAction Id="CreateScheduledTask"
    Return="check"
    Impersonate="no"
    Execute="deferred"
    BinaryKey="WixCA"
    DllEntry="CAQuietExec" />

<!--Delete CcsReturnProcess Scheduled Task-->
<CustomAction Id="DeleteScheduledTaskId"
              Property="DeleteScheduledTask"
              Return="check"
              Execute="immediate"
              Value="&quot;[SystemFolder]SCHTASKS.EXE&quot; /DELETE /TN &quot;CcsReturnProcess&quot; /F" />

<CustomAction Id="DeleteScheduledTask"
    Return="check"
    Impersonate="no"
    Execute="deferred"
    BinaryKey="WixCA"
    DllEntry="CAQuietExec" />
Trying the below does not work either.

   <CustomAction Id="CreateScheduledTaskId"
               Property="CreateScheduledTask"
              Return="check"
              Execute="immediate"
               Value="&quot;[SystemFolder]SCHTASKS.EXE&quot; /CREATE /SC DAILY /MO 1 /ST 10:00 /TN &quot;CcsReturnProcess&quot; /TR &quot;&quot;[INSTALLFOLDER]CcsReturnProcess.exe&quot;&quot; /RU &quot;[Service.Domain]\[Service.User]&quot; /RP &quot;[Service.Password]&quot; /RL HIGHEST" />

It seems like my [Service.User] is not being passed in. I've had a look at the msi log and it shows that the username and password is empty???

MSI (s) (44:E0) [16:51:48:275]: PROPERTY CHANGE: Adding CreateScheduledTask property. Its value is '"C:\windows\SysWOW64\SCHTASKS.EXE" /CREATE /SC MINUTE /MO 20 /TN "CcsReturnProcess" /TR ""D:\ScheduledTasks\CcsReturnProcess\CcsReturnProcess.exe"" /RU "" /RP "" /RL HIGHEST'.

Can anyone advise how to get this working?

like image 818
james Avatar asked Mar 14 '23 10:03

james


1 Answers

Properties that the user provides to the installer must be uppercase and therefore public.

like image 165
Bob Arnson Avatar answered Apr 19 '23 08:04

Bob Arnson