Page 1 of 1

SQL Server 2008 Express uninstalling on upgrade

Posted: Tue Aug 04, 2009 11:05 pm
by rev23dev
When I perform an upgrade, SQL Server 2008 Express always removes and reinstalls itself.

On Upgrade or Uninstall I don't want that pre-req to be touched. What am I missing?

Thanks!

Posted: Wed Aug 05, 2009 5:48 am
by MichaelNesmith
InstallAware scripts do not uninstall technology runtimes like SQL Server. If you added code to remove them, you can simply conditionalize that code such that it runs only if an upgrade is not being performed.

Posted: Wed Aug 05, 2009 8:25 am
by rev23dev
Michael,

I definitely haven't added any code. All I did was select SQL Server 2008 as a pre-requisite.

If I run the install once, it (sql server 2008 express) installs. If I build the install again, sqlexp uninstalls and then reinstalls itself.

Posted: Wed Aug 05, 2009 8:37 am
by MichaelNesmith
Did you specify the correct instance name to install and check for? It seems to me that the prereq check is not set up correctly - you choose the instance to check for, so verify that to avoid reinstalls.

Posted: Wed Aug 05, 2009 8:38 am
by rev23dev
Indeed. It is set to default instance (or, in other words, nothing in that textbox)

Posted: Wed Aug 05, 2009 8:55 am
by rev23dev
Here is what the MSI looks like.

Comment: .NET Application Setup Project

[DEFINE REGION: Check Application Requirements]
Get System Setting 1024x768 Resolution into CHECKSYSTEM
if Variable CHECKSYSTEM not Equals TRUE
MessageBox: $TITLE$ Setup Error, This product requires at least 1024x768 Resolution.$NEWLINE$$NEWLINE$Setup cannot continue.
Terminate Installation
end
Get System Setting 512 MB Physical Memory into CHECKSYSTEM
if Variable CHECKSYSTEM not Equals TRUE
MessageBox: $TITLE$ Setup Error, This product requires at least 512 MB Physical Memory.$NEWLINE$$NEWLINE$Setup cannot continue.
Terminate Installation
end
Comment: Check system has at least Windows 98
Get System Setting Windows XP into CHECKSYSTEM
if Variable CHECKSYSTEM not Equals TRUE
MessageBox: $TITLE$ Setup Error, This product requires at least Windows XP.$NEWLINE$$NEWLINE$Setup cannot continue.
Terminate Installation
end

Comment: Check system has at least Internet Explorer 5.01 Service Pack 1
Get System Setting Internet Explorer 5.01 Service Pack 1 into CHECKIE
if Variable CHECKIE not Equals TRUE
MessageBox: $TITLE$ Setup Error, This product requires Internet Explorer 5.01 Service Pack 1 or later. Please install it and try again.
Terminate Installation
end

<<Code>>

[DEFINE REGION: Check/Install Application Pre-Requisites]

[DEFINE REGION: Check Application Pre-Requisites]
Comment: Check setup pre-requisites
Set Variable PREREQ to FALSE
Set Variable PRELIST to
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Set Variable PREREQ to TRUE
Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Uninstallation
end
Include Script: checkmsi45
Include Script: checkmdac28
Include Script: checkmsi31
Include Script: checknet2sp2
Include Script: checkmsxml60
Include Script: checknet30
Include Script: checknet3sp2
Include Script: checknet351
Include Script: checksql2008
[compiler end]
<<Code>>

[DEFINE REGION: Install Application Pre-Requisites]
Comment: Install setup pre-requisites
if Variable PREREQ not Equals FALSE
Display Dialog: prereq, wait for dialog to return (modal)
if Variable WIZARD Equals CANCEL
Terminate Installation
end
Display Dialog: progressprereq, use as progress dialog (non-modal)
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Set Variable REMOVEOLD to
Set Variable ERROROLD to
Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
if Variable REMOVEOLD Equals ERROR
MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
Terminate Installation
end
if Variable REMOVEOLD Equals REBOOT
MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
if Variable REBOOTNOW Equals OK
Reboot Computer and Resume Setup
else
Terminate Installation
end
end
Set Variable MAINTENANCE to FALSE
end
[DEFINE WEB MEDIA Microsoft Windows Installer 4.5, Exclude from Build]
Include Script: setupmsi45
[DEFINE WEB MEDIA Microsoft MDAC Refresh 2.8, Exclude from Build]
Include Script: setupmdac28
[DEFINE WEB MEDIA Microsoft Windows Installer 3.1, Exclude from Build]
Include Script: setupmsi31
[DEFINE WEB MEDIA Microsoft .NET Framework 2.0 with Service Pack 2, Exclude from Build]
Include Script: setupnet2sp2
[DEFINE WEB MEDIA Microsoft XML Parser 6.0, Exclude from Build]
Include Script: setupmsxml60
[DEFINE WEB MEDIA Microsoft .NET Framework 3.0, Exclude from Build]
Include Script: setupnet30
[DEFINE WEB MEDIA Microsoft .NET Framework 3.0 Service Pack 2, Exclude from Build]
Include Script: setupnet3sp2
[DEFINE WEB MEDIA Microsoft .NET Framework 3.5 with Service Pack 1, Exclude from Build]
Include Script: setupnet351
[DEFINE WEB MEDIA Microsoft SQL Server Express 2008 with Service Pack 1, Exclude from Build]
Include Script: setupsql2008
[compiler end]
Hide Dialog
end
<<Code>>

Posted: Wed Aug 05, 2009 8:57 am
by rev23dev
except that last bit should be this. forum didn't like the end text of that for some reason.

[DEFINE WEB MEDIA Microsoft .NET Framework 3.0, Exclude from Build]
Include Script: setupnet30
[DEFINE WEB MEDIA Microsoft .NET Framework 3.0 Service Pack 2, Exclude from Build]
Include Script: setupnet3sp2
[DEFINE WEB MEDIA Microsoft .NET Framework 3.5 with Service Pack 1, Exclude from Build]
Include Script: setupnet351
[DEFINE WEB MEDIA Microsoft SQL Server Express 2008 with Service Pack 1, Exclude from Build]
Include Script: setupsql2008
[compiler end]
Hide Dialog
end
<<Code>>

Posted: Wed Aug 05, 2009 8:58 am
by rev23dev
And the SQL script

if Variable SQL2008 Equals FALSE
Set Variable PROGRESSTEXT to Installing Microsoft SQL Server Express 2008
Set Variable PROGRESSMODE to MARQUEE
Get System Setting Logged on Computer Name into SQL_COMPUTER_NAME
Get System Setting Logged on User Name into SQL_USER_NAME
Install SQL Express (2008, command line: /SECURITYMODE=SQL /SAPWD="sysadmin" /INSTANCENAME="SQLEXPRESS" /FEATURES=SQLENGINE,REPLICATION,SNAC_SDK /SQLSVCACCOUNT="NT AUTHORITY\\NETWORK SERVICE" /SQLSYSADMINACCOUNTS="$SQL_COMPUTER_NAME$\\$SQL_USER_NAME$", get result into variable SQL2008)
Set Variable PROGRESSMODE to
if Variable SQL2008 Equals 3010
MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
if Variable REBOOTNOW Equals OK
Reboot Computer and Resume Setup
else
Terminate Installation
end
else
if Variable SQL2008 not Equals 0
MessageBox: $TITLE$ Setup, Microsoft SQL Server Express 2008 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
end

Posted: Wed Aug 05, 2009 9:12 am
by rev23dev
And this guy:

Check Service State for SQL Server (SQLEXPRESS) (write result into variable SQL2008)
if Variable SQL2008 Equals NOTINSTALLED
Comment: SQL 2008 Express has stringent operating system and service pack requirements
Get System Setting Service Pack 2 into ISSP2
if Variable ISSP2 Equals FALSE
Get System Setting Windows Vista into ISVISTA
if Variable ISVISTA Equals FALSE
MessageBox: $TITLE$ Setup, $TITLE$ requires at least Service Pack 2 or later. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
Terminate Installation
end
end
Set Variable SQL2008 to FALSE
Set Variable PREREQ to TRUE
Set Variable PRELIST to $PRELIST$$NEWLINE$Microsoft SQL Server Express 2008
else
Set Variable SQL2008 to TRUE
end

Posted: Wed Aug 05, 2009 10:04 am
by MichaelNesmith
Looks like the service check is failing, I'd run it under the debugger to see what's going on.

Posted: Wed Aug 05, 2009 10:28 am
by rev23dev
I don't have a debugger. I have developer edition.

Posted: Wed Aug 05, 2009 11:52 am
by rev23dev
Figured it out. Service name needed to be MSSQL$SQLEXPRESS