Page 1 of 1
Reduce reboots by combining script code
Posted: Fri Sep 03, 2010 9:30 am
by Balanced-Plus
Hi,
My installation installs a.o. SQL Server and prerequisites.
One of which is Windows installer 4.5.
After installation of WI 4.5 a reboot is required.
Also I need to add a registry value (if it doesn't exists) and then the system also needs a reboot.
Key: HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\IRPStackSize
Value: 50
I was hoping the registry check/add can be integrated into the check for WI 4.5. If either one of them (or both) needs to be installed one reboot will be done.
Two questions:
1. How can I check for a certain registry value and add it if it doesn't exists?
2. How can I integrate this Check for - Add to registry into the project, so users only have to reboot once.
I would realy appreciate some sample code, as searching this forum on "registry check read" is too common for the search???
Re: Reduce reboots by combining script code
Posted: Fri Sep 03, 2010 3:21 pm
by mills
1. Check registry checks for the existence of a registry key or value. If the key or value exists, the function returns the associated data. If the key or value does not exist, the function returns a specific error code. Check Registry is similar to Read Registry, except it returns error codes instead of empty values when the requested data does not exist.
Use Write Registry to write to registry.
2. Look at the script "setupmsi45" that is included when you choose Windows installer 4.5 from the runtimes list. The reboot logic is clearly laid out there. You can modify that script and any others to suit your needs.
Most of the answer you will be able to find by searching the help (press F1 in the IDE). We will be improving our forum search soon, but in the mean time you can use google and include "site:installaware.com/form" in your search.
Re: Reduce reboots by combining script code
Posted: Sat Sep 04, 2010 1:43 am
by Balanced-Plus
Hi,
I did the following:
CheckIRPStackSize (custom script):
This works correctly.
Code: Select all
Check Registry Key HKLM\\SYSTEM\\CurrentControlSet\\Services\\lanmanserver\\parameters\\IRPStackSize into IRPSS
if Variable IRPSS Equals NO$VALUE
Set Variable IRPSSINSTALLED to FALSE
Set Variable PREREQ to TRUE
Set Variable PRELIST to $PRELIST$$NEWLINE$Registry modifications needed
end
SetupIRPStackSize (custom script):
This is executed, but registry-key isn't added.
Code: Select all
if Variable IRPSSINSTALLED Equals FALSE
Write Registry Key HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\\IRPStackSize, 50
Set Variable REBOOTBP to TRUE
end
setupmsi45:
Changed this script -> Computer is restarted as expected.
Code: Select all
if Variable MSI45 Equals FALSE
Set Variable MSI45PATH to
Define File Bag : #IADIR#\runtimes\msi45bin\*.*, include files recursively, get runtime location of files into variable MSI45PATH
Set Variable PROGRESSTEXT to Installing Microsoft Windows Installer 4.5
Set Variable PROGRESSMODE to MARQUEE
if Variable ISVISTA Equals TRUE
Run Program wusa.exe "$MSI45PATH$\Windows6.0-KB942288-v2-x86.msu" /quiet /norestart (WAIT, get result into variable MSI45)
else
if Variable IS2003 Equals TRUE
Run Program $MSI45PATH$\WindowsServer2003-KB942288-v4-x86.exe /quiet /norestart (WAIT, get result into variable MSI45)
else
Run Program $MSI45PATH$\WindowsXP-KB942288-v3-x86.exe /quiet /norestart (WAIT, get result into variable MSI45)
end
end
Set Variable PROGRESSMODE to
if Variable MSI45 not Equals 0
if Variable MSI45 Equals 3010
*** CHANGED
Set Variable REBOOTBP to TRUE
end
else
MessageBox: $TITLE$ Setup, Windows Installer 4.5 could not be installed. Please use Windows Update to manually install this update on your system.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
Terminate Installation
end
end
*** CHANGED / ADDED
if Variable REBOOTBP Equals TRUE
MessageBox: $TITLE$ Setup, Restart is needed.
Reboot Computer and Resume Setup
else
Terminate Installation
end
The problem is that the registrykey
SetupIRPStackSize isn't added.
Write Registry Key HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\\IRPStackSize, 50
I've also tried it with double \\:
Write Registry Key HKLM\\SYSTEM\\CurrentControlSet\\Services\\lanmanserver\\parameters\\IRPStackSize, 50
What is wrong here?
Re: Reduce reboots by combining script code
Posted: Sat Sep 04, 2010 5:31 am
by Balanced-Plus
I found out that one has to use "Apply Install"to actually save the changes, but that messes up the remainder of the installation, because "Apply install" will be called twice. Some dialog will be skipped where a user normally could enter some preference (like installationfolder).
Any suggestions on how to solve this?
Re: Reduce reboots by combining script code
Posted: Tue Sep 07, 2010 1:53 pm
by mills
You can either just call the one Apply Install once later in the script. You might find that you'll need to create a second installer to run silently to accomplish your goal.
Re: Reduce reboots by combining script code
Posted: Tue Sep 07, 2010 2:56 pm
by Balanced-Plus
I've decided to create my own runtime for this.
All other solutions did mess up my installation in some way.