PDA

View Full Version : Detect if Restart Required



sjohnst4
11-25-2004, 12:08 PM
Hi

I have looked through the forums here and on the web and cannot find a definative answer that works for me.

I am working purely in installscript and not with any custom actions etc. At the end of my installation I promp the user to reboot the PC. However if the user selects not to reboot, I need a way to detectthis at the start of my script to stop another installation being run before the first has ben rebooted.

I have tried the following line of code:

MsiSetMode(ISMSI_HANDLE, MSIRUNMODE_REBOOTNOW, TRUE);

and then checked the registry at:

"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce." to look for a value, but nothing is there.

Is it possible to do what I want from installscript?

Thanks for any help


Steve Johnston

RobinH
12-06-2004, 02:26 PM
Hi Steve,

Try this. Write a key value under the RunOnce Key. The value can be anything ...your product name, an abbrevation. And then in OnBegin, Add a check for the value you've written. If it exist, exit the installation, and display a message to the user they need to reboot to before continuing.