DLeeRI
Flexera beginner

How to force a restart from InstallScript Custom Action using Suite Project file

Objective

I need to be able to restart a system after a suite installer InstallScript custom action finishes.

Background

I have a requirement to do the following:

  • Uninstall an instance of SQL Server 2012 Express (done)
  • Create that instance using SQL Server 2016 Express (done - except when there is a PendingFileRenameOperations )
  • Sometimes the uninstall of SQL Server 2012 Express will create a new PendingFileRenameOperations. If this exists, then the next step to install SQL Server 2016 will fail. 
  • If the user just restarts after getting the error, then the suite installer does not call the OnResuming event - which contains a step to collect setup information that the installer writes to a config file in the OnRebooting event. This leaves the suite installer starting over and trying to access database settings and values that do not exist since the install for SQL Server 2016 did not finish.

What I have so far

  • I can correctly detect if the system requires a reboot by querying the appropriate registry keys
  • If I just force an exit of the setup, that does not cause the installer to restart after the user has restarted the system and logged back in. 
  • I have thought about manually writing to the RunOnce registry key, but I am not certain of the syntax for this. 
  • I already check for PendingFileRenameOperations and RunOnce registry keys when starting the install and correctly ask the user to restart the computer before starting the install. However, this does not fix this current issue, where the Uninstall of SQL Server 2012 Express instance will generate a PendingFileRenameOperations . 

Thank you in advance. 

 

Labels (1)
0 Kudos
1 Reply
MarkusLatz
Frequent contributor

I have a similar scenario in a suite project. What I did is I have written a small .NET exe console program, which just return with different error codes. In your case, like a vc++ prereq, just return 1641 or 3010 and set the appropriate "Exit Behavior" and "Reboot Request".

To control the execution I use the "eligibility conditions" and "detection conditions"

regards

Markus

0 Kudos