Video Screencast Help

Resuming installation after reboot...

Created: 09 Sep 2010 • Updated: 10 Sep 2010 | 4 comments

OK, so let me explain this in understandable terms:

1) Uninstall previous version of the application. 

*Reboot*

2) Install latest version.

*Reboot*

3) Install update.

Question:

In the script we have the option of "runonce". In the script, I can uninstall the previous version and after placing the msi in a location, put in a runonce key for the latest version to run from that location after a reboot. And once it installs the latest version, I can have the system do another reboot.

My question is, how would I make the update run after the second reboot? Do I put in a condition in the latest version msi? If so, how?

Let me know if I am clear in explaining this issue...

Comments 4 CommentsJump to latest comment

EdT's picture

The beauty of "runonce" is that you can use it repeatedly so that the next process is started after reboot.

The easiest implementation happens when each stage of an install has a separate executable associated with it, so you just install all the components into a temp folder and then run them in turn, using RunOnce as appropriate.

However, as your subject line mentions Resuming Install after Reboot, I am going to assume that you want to re-run an existing install, but each time want to go to a different point in the install.

This requires you to place some sort of "flag" on the machine to indicate where the install reached prior to the last reboot.  So for example, you could write a flag in the registry at HKLM/Software/YourCompany/YourApp , such as Stage=0 when the install starts.

Then set Stage = 1 before the next reboot, so that when the install restarts, it can check the value of "Stage" and jump to the appropriate point in the install to continue where it left off.

This type of process requires a scripting language such as Wisescript or VBScript in order to be able to handle the logic and to be able to read and write into the registry.

Creating a control script to do all these things is quite straightforward, and from what you have posted, it sounds like you are at least part way there already.

I hope this answers your question, but if you need any more information, please let us know.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

VBScab's picture

To my mind, there are only a limited set of circumstances that absolutely require a reboot and they should be avoided if at all possible.

Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.

scriptinguy11's picture

Before answering to your question, I have a question here:

When you restart the machine after uninstalling the previous version, latest version will be installed to the USER PROFILE. The application will be installed to the user iff the user has admin rights. Make sure the user has admin rights before going ahead with this.

If i were you i would probably use single script to do all the tasks.

For example:  c:\temp\Install.vbs

Content of the script will be as follows:

'=================================
IF EXISTS PREVIOUS VERSION THEN
   UNINSTALL PREVIOUS VERSION
   RUNONCE - EXECUTE SCRIPT C:\temp\Install.vbs
   REBOOT USING "SHUTDOWN -r -t 0"
   EXIT SCRIPT
END
 

IF NOT EXISTS LATEST VERSION THEN
   INSTALL LATEST VERSION 
   RUNONCE - EXECUTE SCRIPT C:\temp\Install.vbs
   REBOOT USING "SHUTDOWN -r -t 0"
   EXIT  SCRIPT
END
 

IF EXISTS LATEST VERSION THEN
   INSTALL UPDATE
   EXIT  SCRIPT
END
'=================================
 

Execute SHUTDOWN command in SHELL.RUN()

EXIT SCRIPT - wscript.quit()

Use registry entries to check for existance of previous/latest versions of the application.

VBScab's picture

>after uninstalling the previous version, latest version will be installed to the USER PROFILE
How did you come to that conclusion?

>The application will be installed to the user iff the user has admin rights.
Er.....no

>Make sure the user has admin rights before going ahead with this
Only a fool would preside over an estate where users have admin rights. That's what deployment systems are for.

Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.