Jump to content

This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.

Executing CA after InstallFinalize

2 replies to this topic


  • Members
  • 1 posts

Posted 27 October 2006 - 17:08

Please help.

I need to execute CA wich runs InstallScript function after InstallFinalize. But this error appears:

MSI © (3C:90) [18:37:16:020]: Doing action: CreateCustomEnvironment
Action 18:37:16: CreateCustomEnvironment.
Action start 18:37:16: CreateCustomEnvironment.
Action 18:37:16: CreateCustomEnvironment. Dialog created
MSI © (3C:2C) [18:37:17:598]: Doing action: CreateCustomEnvironmentAction
Action 18:37:17: CreateCustomEnvironmentAction.
Action start 18:37:17: CreateCustomEnvironmentAction.
MSI © (3C:B0) [18:37:17:598]: Invoking remote custom action. DLL: C:\DOCUME~1\kkri\LOCALS~1\Temp\MSIE0F.tmp, Entrypoint: f6
Action ended 18:37:17: CreateCustomEnvironmentAction. Return value 3.
DEBUG: Error 2896: Executing action CreateCustomEnvironmentAction failed.
Internal Error 2896. CreateCustomEnvironmentAction
Action ended 18:37:17: CreateCustomEnvironment. Return value 3.
Action ended 18:37:17: INSTALL. Return value 1.

For creating MSI package I use InstallShield Developer 8.


  • Full Members
  • 3 posts

Posted 21 February 2007 - 23:07

Make sure it is set to "Immediate" since all the defered CAs are handled during InstallFinalize. It won't know what to do with a defered CA that is scheduled after that.

Just an idea.


  • Moderators
  • 1,447 posts

Posted 22 February 2007 - 08:47

PThomas is right that deferred mode custom actions can not be added after InstallFinalize and that immediate mode custom actions can be added after InstallFinalize. However, there should be no custom actions after InstallFinalize at all. There are 3 main reasons for this (off the top of my head):

1: Changes made after InstallFinalize cannot be rolled back. As such this is a violation of MSI design rules and concepts.

2: If the custom action after InstallFinalize returns an error and you haven't set the custom action to ignore the return value I have seen cases where the install itself or a major upgrade will fail mysteriously.

3: In my experience immediate mode custom actions after InstallFinalize are not correctly run when the setup is installed in silent mode (I have had different results depending on what type of custom action it is, but in general I wouldn't trust it).


December 2017, 4: One more reason that I forgot all those years ago - in the heat of the moment: immediate mode custom actions don't run with elevated rights when the setup is being installed in the context of a non-admin user. Hence they will fail with access violations. It is not that they might, given the right circumstances they definitely will - 100% guaranteed. You can not ignore this problem. Note that this problem may not be immediately apparent if you manually run the setup using a local admin account (which is normally done) - this is because it has real admin rights and don't require "elevated rights" (which is different - in effect temporary admin rights for the duration of the MSI install for a non-admin user). So the setup will appear to work with these immediate mode custom actions after InstallFinalize when you run as a real admin - even if they are wildly wrong - but once you try to deploy them via a deployment system such as SCCM which uses elevated rights you will immediately see the custom actions fail or be skipped entirely. A very serious MSI design flaw! You will also see this if you set the AlwaysInstallElevated group policy - essentially just a way to test how your MSI will behave if run via a deployment system. Hence you should use this policy to test your setup with elevated rights on a virtual machine.


Rules of thumb that really matter:

- all custom actions that make changes to the system must be run in deferred mode.

- you should test your setup featuring custom actions using a virtual machine with the AlwaysInstallElevated policy set to see how your setup copes with elevated rights. Make sure to invoke your setup as a regular user.

- no changes should be made to the system using immediate mode custom action inserted only in the setup GUI (no deferred mode custom actions will run at all from the GUI - hence many people use immediate mode custom actions here to change stuff. This is always wrong - no exceptions). All GUI custom actions will never run in silent mode, and your setup will hence be incomplete.

- only set properties and inspect the system in GUI mode!


Let me link together another post that might be helpful:


Edited by Glytzhkof, 20 December 2017 - 10:44.
Fleshing out the most important point: immediate mode custom action do not elevate with temporary admin rights.

-Stein Åsmul