Nico-D
Posts: 63
Joined: Mon Aug 18, 2008 2:34 pm

[custom actions] - Cannot launch a command-line

Hello,

As I am not 100% compliant with Custom Actions ;), I have a problem that I cannot solve. But it seems simple!
This post is related to one of my preceding: http://www.advancedinstaller.com/forums ... f=2&t=7956

I install a "special" service using a CA (EXE w/ Working Directory) under InstallExecuteSequence>Install, Sync. exec. & check return code, defferred w/ no impersonation. The binary is shipped, of course.

This works fine, I have my service installed, it could be launched, etc. I can modify it using sc.exe (in %SystemFolder%) and the command-line works fine:

Code: Select all

sc.exe failure myService reset= 20000 actions= restart/1000
This make my myService restart once after a crash, after 1 second.

The problem is that I am not able to make this during an install using a CA! :( I am using an InstallExecuteSequence>Install with a "EXE with path given by a Property" CA, Sync. exec. & check return code, defferred w/ no impersonation. This leads to an error at the end of the install "A program required for this install could not be run...".

Using the same CA but w/ Async. exec., wait for return code at the end of the sequence, leads to an error-free instal, but the "sc.exe" command did not applied any changes.

The CA command-line I am using is

Code: Select all

[SystemFolder]sc.exe failure myService reset= 20000 actions= restart/1000
Do you have an idea of what is wrong?

Moreover, could you recommend me a good pointer to a site where Custom Actions are explained in details?

Best regards,
-- Nicolas D.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: [custom actions] - Cannot launch a command-line

Hi Nicolas,

Perhaps the custom action runs to early. Please try scheduling it under "InstallExecuteSequence" -> "InstallFinalize", checking the return code. If the behavior is the same, please send us the AIP you are using and a log of the install process to support at advancedinstaller dot com so we can investigate them.
Moreover, could you recommend me a good pointer to a site where Custom Actions are explained in details?
Unfortunately, we don't know any sites for this. We generally use the MSDN articles for information about Windows Installer. The custom action articles may contain a lot of details, but they use low level notions and terms. By implementing the custom actions in Advanced Installer, we made them easier to understand and configure.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Nico-D
Posts: 63
Joined: Mon Aug 18, 2008 2:34 pm

Re: [custom actions] - Cannot launch a command-line

Hi Cosmin,

Thank you for your reply.
Perhaps the custom action runs to early. Please try scheduling it under "InstallExecuteSequence" -> "InstallFinalize", checking the return code.
I think I had already tried this solution. I will check another time, an will send the AIP file if it does not work as I want.
We generally use the MSDN articles for information about Windows Installer.
Thanks for this.

Regards,
-- Nicolas D.
Nico-D
Posts: 63
Joined: Mon Aug 18, 2008 2:34 pm

Re: [custom actions] - Cannot launch a command-line

Hi Cosmin,

After several test on a small package, it is working as you said (and as I tried). The solution is to use an "EXE with Working Directory..." CA under InstallFinalize, invoking the command:

Code: Select all

[SystemFolder]sc.exe failure XYNTService reset= 200000 actions= restart/1000
The execution condition is (Not Installed).

Regards,
-- Nicolas D.

Return to “Common Problems”