Jump to content

RunOnce does not execute after Windows Installer re-boot


Recommended Posts

Hi everyone,

I have developed an application which requires other Microsoft components and other 3rd party device driver to be installed on the target machine. As I can only get InstallShield and .MSI files from the 3rd party vendor, I am writing a small installer application that spawns the required MS component intsallers and 3rd party's installer packages. My installer detects which software has not been installed and spawns the appropriate installer package.

One of the software that I need to install first is Windows Installer 3.1, if it has not been installed on the target machine. At the completion of Windows Installer 3.1 installation, the PC is required to be re-booted.

As I need to restart my installer after the PC has been restarted, I added the following registry value Install = "C:\MyInstallDir\Install.exe" in the HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/RunOnce registry key, before Windows Installer 3.1 installation is spawned. However, the Install program did not get executed after the PC re-started. The entry in the RunOnce registry key was still there.

If I re-boot the PC manually, with the above RunOnce registry value, my Install.exe gets executed.

I have tried using the following registry keys with the same result:

HKCU/SOFTWARE/Microsoft/Windows/CurrentVersion/RunOnce

HKCU/SOFTWARE/Microsoft/Windows/CurrentVersion/Run

HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/Run

Does any one know the differences between Windows Installer automatic reboot and manually rebooting the PC?

Can anyone please advise how to correctly use the RunOnce registry key to resolve the problem?

Thanks,

Andy

Link to comment
Share on other sites


I use runonceex and my installs resume (I just increment the autologon for every reboot).

I know there once was criteria like putting an (!) before your entry in the RUN key to get it to execute upon restart, dont know if that went by the wayside because its never worked for me. The runonceex deletes lines as executed and will run any remaining lines upon restart. dont know if GUIrunonce will perform similarly?

Link to comment
Share on other sites

I tried your suggestion. After Windows Installer completed the installation and rebooted the PC, I noticed the entry under RunOnceEx registry key was deleted, but my program still didn't get executed. I tried prefixing the value name with "!", but still didn't work.

Link to comment
Share on other sites

Hi imtheky,

Thanks for the explanation.

At the completion of Windows Installer 3.1 installation and before the PC was rebooted, the RunOnceEx registry entry was there. After the PC has been re-booted, the entry was gone, but the program in the RunOnceEx registry entry did not get executed. This happens in normal mode and Safe mode.

I also did a test, where I chose not to let Windows Installer 3.1 installation to automatically reboot the PC upon completion, by checking the "Do not restart now" checkbox. Then I manually restarted the PC. If I did this, the RunOnceEx intermittently got executed. Really weird.

Link to comment
Share on other sites

yeah they shouldnt run in safemode out of the runonce.

Since the entry remained present when you booted into safe mode that just shows it was not attempting and failing.

Why not slipstream installer3.1? that way you can eliminate its peculiar function from the runonce.

KB893803 /integrate:%source%

might help if you post the other entries you are trying to run and see if they might be to blame as well.

Link to comment
Share on other sites

I might not be clear enough in my previous post. When the PC was booted into Safe mode, the RunOnceEx entry was gone.

There is only 1 program that I am trying to run.

Below is the code I used to add the RunOceEx registry entry.

// Code snippet to add RunOnceEx entry

//

// check, if RunOnceEx registry key exists {

if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx", 0, KEY_ALL_ACCESS, &hRunOnceKey ) != 0 )

{

// if not, attempt to create it

if( RegCreateKey( HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx", &hRunOnceKey) != 0)

{

// failed to create RunOnceEx registry key

return -1;

}

}

// create a new registry key for our application

if( RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\1",&hRunOnceKey) != 0)

{

return -1;

}

// Set registry value

Len = 512;

sprintf( Path, "%s\\Install.exe -1", CurrentDir );

if( RegSetValueEx( hRunOnceKey, "!1", NULL, REG_SZ, (BYTE*)Path, Len ) != ERROR_SUCCESS )

{

return 0;

}

RegCloseKey( hRunOnceKey );

Link to comment
Share on other sites

have you tried getting away with a

Net stop msiserver

after the install, maybe whoever needs it next will call the new stuff? (could very well yield the cant be accessed error but I'd try it)

The intermittent functionality makes it brutal. The key looks fine when you comment out all the 3.1 stuff and run it?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...