cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Tobias79
Level 5

Exit code processing with InstallScript for SQL 2008R2 Express

Hi all,

Am writing a installer installing the MS SQL 2008 R2 Express Edition. Now as Microsoft recommends (comp. http://msdn.microsoft.com/en-us/library/dd981032%28SQL.100%29.aspx) I want to check the exit codes given by the SQL installer. To do so I started writing a InstallScript CA:

nResult = LaunchAppAndWait(RootDir ^ "SQLEXPR_x64_ENU.exe" , "/IACCEPTSQLSERVERLICENSETERMS /ACTION=INSTALL /INSTANCENAME=MYINSTANCE /SECURITYMODE=SQL /SAPWD=MYPASSWORD", LAAW_OPTION_WAIT);
nExitCode = LAAW_PARAMETERS.nLaunchResult;

SprintfBox (INFORMATION, "System Information", "%ld", nExitCode);


How must I modify the code to process the exit codes
0 = Successful installation.
0xBC2 = Successful installation; however, a system reboot is required.
0x84c408 = .NET is required.
84c40010 = Microsoft Windows Installer 4.5 is required.

Or any other ideas for good error code handling here ?

Thanks and best regards
Tobias
Labels (1)
0 Kudos
(2) Replies
Tobias79
Level 5

Any ideas ? Thanks
Tobias
0 Kudos
Tobias79
Level 5

Ok just figured it out. Works with the following code (Problem was hex representation in errorcode):


//Install SQL Server Express 2008R2 Instance
nResult = LaunchAppAndWait(RootDir ^ "SQLEXPR_x64_ENU.exe" , "/IACCEPTSQLSERVERLICENSETERMS /ACTION=INSTALL /INSTANCENAME=MYINSTANCE /SECURITYMODE=SQL /SAPWD=MYPASSWORD", LAAW_OPTION_WAIT);

// retrieve exit code as string, as it is in hex Sprintf is used to get string
nExitCode = LAAW_PARAMETERS.nLaunchResult;

Sprintf (szExitCode, "0x%lx", nExitCode);

if (szExitCode=="0x0") then
szExitCode="0";
endif;

SprintfMsiLog("Microsoft SQL Server 2008 R2 Express Edition installation closed with exit code: " + szExitCode);

// Installation ok if exit code is 0 or 0xBC2
// comp. http://msdn.microsoft.com/en-us/library/dd981032%28SQL.100%29.aspx
if (szExitCode != "0") then

if (szExitCode != "0xBC2") then
MessageBox("Installation SQL server not sucessful!",INFORMATION);
return -1;
endif;

endif;
0 Kudos