In my MSI installer package I have a custom action which adds a RunOnce key. However, it surprised me to observe that, at the end of the install, the RunOnce key is invoked immediately (and then deleted), whereas I was anticipating this to occur only when the pc is restarted. Is this behaviour standard, or can it be switched off? This is happening on Windows 7 64-bit. Any help gratefully received, many thanks in advance. Cheers, Andrew.
Asked
Active
Viewed 943 times
1
-
Perhaps I should add that this does not happen on XP (32-bit); the RunOnce key is not invoked until machine restart. Thus I'm not certain of what the expected or default behaviour should be. – AndrewK Sep 21 '11 at 15:09
2 Answers
3
Can you try the package on another Win7 machine, even virtual machine? From what I know only the restart should invoke the key, so maybe there is something corrupted on this machine that causes the behavior.
EDIT: After posting I found this MSDN blog which says the key can get invoked in certain conditions. http://blogs.msdn.com/b/junfeng/archive/2006/09/19/761765.aspx
To avoid the key invocation you could try to execute the custom action that creates it as late as possible during the installation.

Bogdan Mitrache
- 10,536
- 19
- 34
-
Thanks, Bogdan, for your assistance. Your blog reference was helpful, I will be investigating the points it raises. Cheers. – AndrewK Sep 22 '11 at 13:53
2
I solved my problem by using the RunOnceEx reg key, instead of RunOnce. Everything works as expected now. Cheers!

AndrewK
- 31
- 2