0

the following sequence executes correctly on Windows 10 but on Windows 7 seems not to execute:

<Component Id="TargetProgram" Win64="yes" Guid="32BBAECC-AC90-4F79-8E59-8D5B3FA5D4DE">
  <File Id="EXE" Source="c:\Windows\system32\sc.exe" />
</Component>

<CustomAction Id="EXECUTE_AFTER_FINALIZE"
              Execute="immediate"
              Impersonate="no"
              Return="asyncWait"
              FileKey="EXE"
              ExeCommand="config SomeService start=delayed-auto" />

<InstallExecuteSequence>
  <Custom Action="EXECUTE_AFTER_FINALIZE" After="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>

Do anybody know what the problem is under Windows7? Thanks.

mca
  • 466
  • 3
  • 11
  • Might be a dependency issue. However, you should use WiX constructs to install services: [Installing Services with WiX](https://stackoverflow.com/a/57945264/129130). [Samples here](https://stackoverflow.com/a/53735159/129130). [Direct link into source here](https://github.com/rstropek/Samples/blob/master/WiXSamples/WindowsService/ServiceInstaller/Product.wxs#L25). There is an attribute for delayautostart, though I have not tried it: [Documentation](https://wixtoolset.org/documentation/manual/v3/xsd/wix/serviceconfig.html). And [SO answer on issue](https://stackoverflow.com/a/9158372/129130). – Stein Åsmul Feb 12 '20 at 14:48
  • The WiX elements will have been through better testing than your own constructs, and custom actions are always hard work to get right. [MSI Best Practice is to try to eliminate them](https://stackoverflow.com/a/46179779/129130) - very often you can. A lot of risk eliminated and a simpler and more reliable package to work with - generally. – Stein Åsmul Feb 12 '20 at 14:53
  • It has to be like described above because my installer is not responsible with the installation of that service. I only want to change the start procedure of that service from auto to delayed-auto. My setup runs a MSI which is responsible with the service installation. – mca Feb 13 '20 at 08:41
  • Firstly the custom action is run immediate which means that it does not run elevated (unless you kick off the whole install to run elevated). Secondly, can you do this via Active Directory, scripting or logon scripts instead? The command you run works when run manually? – Stein Åsmul Feb 13 '20 at 08:50
  • The command runs well when executed from command prompt. Active Directory scripting is out of question. – mca Feb 13 '20 at 17:05
  • Did you run with admin rights from the command prompt? If so, then you need to try and run the above command elevated too. Try to set it deferred first: `Execute="deferred"` - you likely need further tweaking, but give it a go. – Stein Åsmul Feb 13 '20 at 17:10

0 Answers0