cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
SElHadidy
Level 3

SQL Express 2008 R2 installation

I'am having problem installing SQL Server Express 2008 R2 with Installshield.
we want to install it upon customer demand (he'll be prompt with radio buttons specifying whether he wants sql installation to take place or not).

we've tried every trick by the book but to no vain 😞
Tricks
1- Installing using exe customAction, with execution sequence set to deferred after installAllFiles, halting during setup files installation with the following sample from log:
"2011-11-03 16:29:56 Slp: Sco: Attempting to write hklm registry key SOFTWARE\Microsoft\Microsoft SQL Server to file C:\Program Files (x86)\Microsoft SQL Server\100\Setup Bootstrap\Log\20111103_161151\Registry_SOFTWARE_Microsoft_Microsoft SQL Server.reg_
2011-11-03 16:29:56 Slp: Watson Bucket 2017
Original Parameter Values
2011-11-03 16:29:56 Slp: Parameter 0 : SQL Server 2008 R2@RTM@
2011-11-03 16:29:56 Slp: Parameter 2 : Microsoft.SqlServer.Configuration.Sco.AdjustTokenPrivilege.SetPrivilege
2011-11-03 16:29:56 Slp: Parameter 3 : Microsoft.SqlServer.Configuration.Sco.ScoException@1211@1
2011-11-03 16:29:56 Slp: Parameter 4 : System.ComponentModel.Win32Exception@-2147467259
2011-11-03 16:29:56 Slp: Parameter 5 : Install_SqlSupport
2011-11-03 16:29:56 Slp: Parameter 7 : SOFTWARE\Microsoft\Microsoft SQL Server
2011-11-03 16:29:56 Slp: Parameter 8 : SOFTWARE\Microsoft\Microsoft SQL Server
2011-11-03 16:29:56 Slp:
Final Parameter Values
2011-11-03 16:29:56 Slp: Parameter 0 : SQL Server 2008 R2@RTM@
2011-11-03 16:29:56 Slp: Parameter 2 : 0xFF16C34E
2011-11-03 16:29:56 Slp: Parameter 3 : 0x0A2FBD17@1211@1
2011-11-03 16:29:56 Slp: Parameter 4 : 0xC24842DB
2011-11-03 16:29:56 Slp: Parameter 5 : Install_SqlSupport
2011-11-03 16:29:56 Slp: Parameter 7 : 0xE8507517
2011-11-03 16:29:56 Slp: Parameter 8 : 0xE8507517"

2- Installing using Installscript, resulting in return code of 0 without installing the exe (also this script is ran in deferred execution)
function InstallSQLExpress(hMSI)
// To Do: Declare local variables.
STRING sqlPath, cmdLineParameters, returnResultCode;
begin
sqlPath = SUPPORTDIR^"SQLEXPR_x86_ENU.exe";
cmdLineParameters = "/qs /ACTION=Install /FEATURES=SQLENGINE /SECURITYMODE=SQL /SAPWD=\"p@ssw0rd\" /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT=\"NT AUTHORITY\SYSTEM\" /IACCEPTSQLSERVERLICENSETERMS /Hideconsole /SQLSYSADMINACCOUNTS=\"Builtin\Administrators\"";
LongPathToQuote(sqlPath, TRUE);
MessageBox(sqlPath, SEVERE);
LAAW_SHELLEXECUTEVERB = "runas";
LaunchApplication(sqlPath, cmdLineParameters, "", SW_NORMAL, 5000, LAAW_OPTION_USE_SHELLEXECUTE | LAAW_OPTION_WAIT);
SprintfBox(INFORMATION, "Return Code", "App returned %d...", LAAW_PARAMETERS.nLaunchResult);
// To Do: Write script that will be executed when MyFunction is called.
end;

My Os is Win7 x64, and using the sql exe associated with "Microsoft SQL Server 2008 R2 Express RTM (x86 & x64Wow)" prerequisite.

Any help would be very much appreciated 🙂
Labels (1)
0 Kudos
(5) Replies
hidenori
Level 17

You may want to consider using a Feature Prerequisite so that it will be installed only if one or more of the features that contain it are installed.
0 Kudos
skolte
Level 7

I have done something similar. Basically, I wanted to show user a Yes/No option, and if the user says Yes, check if SQL Express Instance with a particular name already exists, if any database exists, or unattached mdf/ldf exist. If not, then silently install SQL Express. I got it working exactly the way I want after struggling for 3-4 days. I will share some of that knowledge with you.

Add your SQL Express Exe to Behavior and Logic > SUPPORT Files section > Language Independent.

Now in your InstallScript, after you have accepted user input, and user chooses to install, all you do is call an InstallScript function that will Install SQL Express. I wrote my method somewhat like this:

function InstallSQLExpress()
begin
//m_SQLExpressArguments - In case you want to pass any command line arguments
//e.g. m_SQLExpressArguments = "ADDLOCAL=All SQLBROWSERAUTOSTART=1 SQLAUTOSTART=1 INSTANCENAME=SIMS DISABLENETWORKPROTOCOLS=1"
//add /qb at the end for silent install

if(Is(FILE_EXISTS,SUPPORTDIR + "SQLEXPR.EXE") = TRUE) then
if (LaunchAppAndWait(SUPPORTDIR + "SQLEXPR.EXE", m_SQLExpressArguments, WAIT) < 0) then
MessageBox( "SQL Server Express installation failed.", SEVERE );
abort;
else
MessageBox( "SQL Server Express installed successfully.", 0 );
endif;
else
MessageBox( "Could not locate the setup program for Microsoft SQL Server (SQLEXPR.EXE). Please locate this file to continue installation.", SEVERE);
abort;
endif;
endif;
end;


The reason to add your EXE to your SUPPORT files is that you can start install right away after they say Yes. Otherwise if you include the SQL Express Installer exe file as just one more file in your installer, you have to wait till all files get copied to destination. Problem with this is if your installation needs database before anything else, you are stuck.
0 Kudos
SElHadidy
Level 3

hidenori wrote:
You may want to consider using a Feature Prerequisite so that it will be installed only if one or more of the features that contain it are installed.


Hey sorry for the late reply, this answered my question and did proper installation of SQL on my machine.

wonder why this worked and not the custom code solution?
is there special privileges running for prerequisites?
0 Kudos
SElHadidy
Level 3

hidenori wrote:
You may want to consider using a Feature Prerequisite so that it will be installed only if one or more of the features that contain it are installed.


Sorry for the late reply, long holiday here 🙂
Thanx man, it worked fine with features prerequisite, but not with InstallScript, even after trying the one attached by Skolte (Thanks by the way)

my question is why it worked with prerequisites only, is there a privileges problem with custom actions even if ran in deferred system context?
0 Kudos
skolte
Level 7

Do you have a sample project that has the InstallScript code and it's not working? If you do have it, post it and I will take a look to see if I can find the reason why it's not working.
Are you sure that the custom action calls the InstallScript method as expected, either put a message box in your method or debug it. Also, I would sequence your Custom Action for InstallScript method call after 'CostFinalize'.

If you want, I might be able to put together a sample for you later tonight to show you how it can be done using pure InstallScript. Let me know if you still need it.
0 Kudos