Control Operation Parameters - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Control Operation Parameters

Using AI 7.7:
I tried to understand how Services work using the following link:
http://www.advancedinstaller.com/user-g ... rties.html

But there's something I can't understand.
What happened is:
To install my Services I use AI (Services to install + Control Operations).
So one Service named: "Observer Encoder" I tried to use your Service Installers, but then I wanted to upgrade I had a new window/dialog open during upgrade (from version 1.0.0 to 1.0.1 for example) that said that "observer encoder" is running and "holding" files that require update.
So what I did is I tried to stop this Service myself before "install" phase. This got me into a lot of problems.
I tried various combinations of start/stop in the "Event On Install" of "Control Operation Parameters for my "Observer Encoder" Service (+ custom actions to start or stop this Service), but couldn't quite make this work without AdvancedInstaller say that I had some error during installation (of course for my custom actions I can ignore the return code and it will work! but I do want to make sure this custom action finished correctly).

I even tried the following:
1. In phase "LaunchConditions" I created a custom action that stops the Encoder: "sc.exe stop "Observer Encoder""
2. for the "Event On Install" of this service nothing is checked, not start, not stop and not delete.
3. For some reason: during the end of the installation, AdvancedInstaller automatically/alone starts "Observer Encoder" Service!!! Although I REMOVED the START in "Event On Install" for this Service!!! (how come? why did it start alone? I checked: no custom action that starts it, and Event On Install is empty! I suspect AdvancedInstaller "remembered" that the Service was started and was not aware of my custom action to stop the Service and that's why is started it alone... yes?)

I guess you understand my frustration: I just can't seem to understand how to work with Services with AdvancedInstaller properly.

I seriously need you help on this one.
Dashut.

P.s: What's the meaning of checking START and also checking STOP in the "Event on Install" for a Service?
Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Control Operation Parameters

More indepth research with "Run and Log" I see that AdvancedInstaller calls the custom actions I created in "InstallFinalize" TWICE!!!
So since I created a custom action to start my Service in "installFinalize", then first time is succeeds (choosing option of: return code is checked) and then for some reason it runs it again.

I have another Service Updater, so here's the log for what happened (we see for the first time "StartUpdaterService" is run at 14:01:14):

Code: Select all

Action 14:01:14: InstallFinalize. 
Action start 14:01:14: InstallFinalize.
MSI (s) (68:B8) [14:01:14:664]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
Action ended 14:01:14: InstallFinalize. Return value 1.
MSI (s) (68:B8) [14:01:14:764]: Doing action: StartUpdaterService
Action 14:01:14: StartUpdaterService. 
Action start 14:01:14: StartUpdaterService.
Action ended 14:01:15: StartUpdaterService. Return value 1.
and later

Code: Select all

MSI (s) (68:48) [14:01:23:905]: Doing action: InstallFinalize
Action 14:01:23: InstallFinalize. 
Action start 14:01:24: InstallFinalize.
MSI (s) (68:48) [14:01:24:033]: User policy value 'DisableRollback' is 0
MSI (s) (68:48) [14:01:24:084]: Machine policy value 'DisableRollback' is 0
Action 14:01:24: RollbackCleanup. Removing backup files
and later:

Code: Select all

Action ended 14:01:29: InstallFinalize. Return value 1.
MSI (s) (68:48) [14:01:29:266]: Doing action: StartEncoderService
Action 14:01:29: StartEncoderService. 
Action start 14:01:29: StartEncoderService.
Action ended 14:01:29: StartEncoderService. Return value 1.
MSI (s) (68:48) [14:01:29:638]: Doing action: StartUpdaterService
Action 14:01:29: StartUpdaterService. 
Action start 14:01:29: StartUpdaterService.
MSI (s) (68:48) [14:01:29:936]: Note: 1: 1722 2: StartUpdaterService 3: C:\Windows\Installer\MSI83CF.tmp 4: sc.exe start "Observer Updater" 
at 14:01:29.936 we see the second time "StartUpdaterService" is run, and that's exactly where the popup window of an error occurs.

Why does this happen? why is it called twice!!?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Control Operation Parameters

Hi,

I'm not sure why this happens. Can you please send us the .AIP (project) file you are using to support at advancedinstaller dot com so we can investigate it?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Control Operation Parameters

FYI: I sent you my *.aip.
Thanks, Dashut.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Control Operation Parameters

Hi,

Please note that the action is not executed twice. It's mentioned in the log twice because the first time it's added to the installation script and the second time it's executed.
For some reason: during the end of the installation, AdvancedInstaller automatically/alone starts "Observer Encoder" Service!!!
This is done by the "StartEncoderService" custom action under InstallFinalize. If you don't want to start the service you can remove this custom action.

Your project seems to be configured correctly for stopping services at the installation beginning and starting them at the end. Can you please give me more details about the problem you are encountering? What doesn't work the way it should?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Control Operation Parameters

What I see is that the Service starts! and when the custom action happens, it fails, because it's ALREADY started!
That's why I thought that the custom action was run twice, so if not: then something else is starting it, and then my custom action fails to start it for the second time.

But how come it starts alone? Maybe because AdvancedInstaller "remembered" that is was started? and wanted to restart it? because I "manually" stopped it with a custom action, and AdvancedInstaller remembered it was started?

Also, I don't understand what is the meaning of checking/putting V on "START" and "STOP" for "Event On Install" for the Service...
Dashut.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Control Operation Parameters

Hi Dashut,

The installer doesn't remember service states, it uses the package configuration to handle services. Does your custom action stop the service successfully at the installation beginning? If so, can you please send us the full installation log so we can investigate it?
I don't understand what is the meaning of checking/putting V on "START" and "STOP" for "Event On Install" for the Service...
These options determine if the service is started or stopped during installation. You can read more about them here. For example, instead of the "StartEncoderService" custom action you can use the "Start" install event.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Control Operation Parameters

I understand that you want to "START" the Service after installation (checking the "Event On Install), and then I also thought that checking "STOP" on "Event On Install" means: if the Service is already installed and running: then stop it.
Correct (otherwise what does it mean to let me check both: START and STOP for "Event On Install"?) ?

I'll send you the complete log very soon.

BTW: I want to stop the Service BEFORE AdvancedInstaller gets to the place where it stops it for me, because if I do not, then I get a dialog window saying that files needed to be replaced are "held" by my Service, and so if I have a silent installation: what will happen after the upgrade is that the computer will reboot! So to avoid these files being "locked" (to avoid the restart of the computer after the upgrade), I decided to manually (using custom action) stop the Service. Also: my "Updater Service" causes these upgrades to happen (it's checking if a new version exists and upgrades): so I want to stop the Updater Service, and only start it when the entire upgrade has been performed successfully.

BTW2: Is there a way to cause the MSI to create a log file or can this only be done from the AdvancedInstaller GUI (Run and Log)?

Dashut.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Control Operation Parameters

Hi Dashut,

You can stop the service using a custom action that launches either of these command line utilities:

Code: Select all

sc stop <yourservicename>
net stop <yourservicename>
Place your custom action before the InstallInvalidate standard action under InstallExecuteSequence. The InstallValidate action is responsible for checking for locked files.

Windows Installer can be instructed to create an install/uninstall log as described in our article on creating a log.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Control Operation Parameters

Hi Dashut,
and then I also thought that checking "STOP" on "Event On Install" means: if the Service is already installed and running: then stop it.
Correct (otherwise what does it mean to let me check both: START and STOP for "Event On Install"?) ?
If both start and stop options are checked, the service is restarted.

The service seems to be started only once during installation. So either the stop custom actions don't successfully stop the services or the failure operations you are setting are used automatically. You can try this:
- after the "KillEncoder" custom action add a ScriptInline custom action with this script code:

Code: Select all

MsgBox "pause"
- add a similar custom action after "RestartUpdaterService" custom action and another one right before "StartEncoderService"

These custom actions will show a simple message box, pausing the installation. This way you can use "services.msc" to determine what happens to the services during installation, if they are stopped correctly and when they are started.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Control Operation Parameters

Okay, good idea, I'll try that and let you know soon.
Dashut.
Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Control Operation Parameters

I just tried adding: pause after "KillEncoder" (in LaunchConditions) but that failed. Here's the log (my custom action name is "LCPause"):

Code: Select all

SI (s) (C8:4C) [15:09:11:328]: PROPERTY CHANGE: Modifying CustomActionData property. Its current value is 'Observer Encoder.exe'. Its new value: 'MsgBox "pause"'.
Action ended 15:09:11: AI_DATA_SETTER_3. Return value 1.
MSI (s) (C8:4C) [15:09:11:359]: Doing action: LCPause
Action 15:09:11: LCPause. 
Action start 15:09:11: LCPause.
At this point I get the window dialog saying I have an error (so that's why there's no more logging)

This is how my custom action is configured (just to make sure I got everything right):
Source Type: Visual basic script (*.vbs)
Script Text: Script Text
Action Data: MsgBox "pause"

(all values other then "MsgBox "pause"" that I entered into "Action Data" where left untouched)
That's it.
Dashut.
Last edited by Dashut on Mon Jun 28, 2010 1:27 pm, edited 1 time in total.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Control Operation Parameters

Hi,

Please note that the script code needs to be in the "Script Text" field, not in "Action Data".

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Control Operation Parameters

Opps... my mistake... fixing...

BTW: is there a way to "slow down" the Installer? Meaning: when I run from the GUI with "Run and Log" the installation is dramatically slower - which is GOOD!
Can I slow it down even more? or even: pause it (other then using this custom action).

Dashut.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Control Operation Parameters

Hi Dashut,

I'm afraid that this is not supported by Windows Installer.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”