Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

RunOnce does not execute after Windows Installer re-boot

Featured Replies

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

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?

  • Author

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.

if you catch it on the programatic reboot and send it into safe mode, are there any entries in the runonce?

  • Author

Not quite sure what you meant with "catch it on the programmatic reboot".

hit whatever key will give you your boot options and select safe mode.

  • Author

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.

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.

  • Author

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 );

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?

  • Author

I'll try some other ways to do it. Thanks for all your help.

Hello,

I have the same problem with you. Did you find anything?

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.