Archive: How can i install SQL Expres inthe slient


How can i install SQL Expres inthe slient
Hi All,
can anybody tell me hhow can we install sql express 2005 in the slient mode with the NSIS


Hi mukeshnaval,

to install SQL Express in Silent mode you should read this first.

There are some parameters and so on you may need.

To call the Setup by CommandLine you should use ExecWait
(look for 4.9.1.4 ExecWait in the Docs).

Using ExecWait will grant that the SQLSetup is finishied before your installer proceeds.

hope this helps,
Greetz

Dave


I have a script that asks for parameters (the sql password for user sa) and then perform a sql express silent install, a client components install and a management console install.
It also asks and eventually installs sql2005 express prerequisites (.net 2.0 and msinstaller 3.0). It's in italian but if you need i can try a translate and send it to you.

basically you have to insert some statements like these:

ExecWait '"SQL2005Express\SQLEXPR\SETUP.EXE" /settings $PLUGINSDIR\SQL2005SRV.ini /qb'
IfErrors 0 +2
Abort "Installation failed"

The SQL2005SRV.ini file is like following:

[Options]
INSTANCENAME=MSSQLSERVER
ADDLOCAL=SQL_Engine,SQL_Data_Files
SECURITYMODE=SQL
SAPWD=<insert your password here>
SQLCOLLATION=<insert your collating here>
DISABLENETWORKPROTOCOLS=0


Hi... sgiusto

can u send me the sample .ini file with the password 'sa'
because i m getting error invalid ini file.

my mailID: mukeshn@icreon.net


Here's what I have to install SQLExpress Advanced and the extra tools section. It should be fairly straight forward to narrow it down to just sqlexpress if you need.

The code also searches to see if they have a pre-existing sql express version and asks them for permission to update. If they have normal sql express w/Advanced, it requires different command line parameters so that adds a little more code to it.

I've tried to delete all my extra code, but I may have missed some things.


!define SQLDest "$PROGRAMFILES\Microsoft SQL Server"
!define SQLCatalog "SQLExpress"

Section /o "SQL Server" secSQLServer
SectionIn 2
;SQL Server needs about 600mbs, but with databases it can get much larger. Asking for 1.5 gigs.
AddSize 1500000
SetOutPath "$INSTDIR\Tools"
SetOverwrite ifnewer
File "F:\Software\SQL 2005 Express\Sqlexpr_toolkit.exe"
File "F:\Software\SQL 2005 Express\Sqlexpr_adv.exe"
File "F:\Software\SQL 2005 Express\Osql.exe"

; search for SQLExpress 2005 instance
StrCpy $1 "SOFTWARE\Microsoft\Microsoft SQL Server\${SQLCatalog}\MSSQLServer\CurrentVersion"
StrCpy $2 "CurrentVersion"

ClearErrors
;MessageBox MB_OK "Checking $1 $2"
ReadRegStr $0 HKLM "$1" "$2"
IfErrors SQLServerNotFound SQLServerFound

SQLServerFound:
;Update version Information when new version of SQL is added to the install
${VersionCompare} $0 "9.00.3042.00" $3
; $3=0 Versions are equal
; $3=1 Version1 is newer
; $3=2 Version2 is newer
${If} $3 == 2
MessageBox MB_YESNO|MB_ICONEXCLAMATION "SQLServer is not on the latest version of 9.00.3042.00; detected version $0.$\nWould you like to upgrade?" IDYES true IDNO false
true:
ExecWait '$INSTDIR\Tools\SQLEXPR_ADV.EXE /qb UPGRADE=SQL_Engine ADDLOCAL=SQL_Engine,SQL_Data_Files,SQL_Replication INSTANCENAME=${SQLCatalog} SECURITYMODE=SQL SAPWD=Password \
SQLBROWSERAUTOSTART=1 DISABLENETWORKPROTOCOLS=0 SQLACCOUNT="NT AUTHORITY\SYSTEM" SQLBROWSERACCOUNT="NT AUTHORITY\SYSTEM" INSTALLSQLDIR="${SQLDest}" \
INSTALLSQLSHAREDDIR="${SQLDest}" INSTALLSQLDATADIR="${SQLDest}"'
ExecWait '$INSTDIR\Tools\SQLEXPR_Toolkit.EXE /qb UPGRADE=Client_Components ADDLOCAL=SQL_WarehouseDevWorkbench,Client_Components,Connectivity,SQL_SSMSEE INSTANCENAME=${SQLCatalog} \
SECURITYMODE=SQL SAPWD=Password SQLBROWSERAUTOSTART=1 DISABLENETWORKPROTOCOLS=0 INSTALLSQLDIR="${SQLDest}" INSTALLSQLSHAREDDIR="${SQLDest}" INSTALLSQLDATADIR="${SQLDest}"'
Goto next
false:
Messagebox MB_OK "Cannot continue without updating SQL Server."
Abort "can't install"
next:
${EndIf}
Goto Continue

SQLServerNotFound:
ExecWait '$INSTDIR\Tools\SQLEXPR_ADV.EXE /qb ADDLOCAL=SQL_Engine,SQL_Data_Files,SQL_Replication INSTANCENAME=SQLExpress SECURITYMODE=SQL SAPWD=Password \
SQLBROWSERAUTOSTART=1 DISABLENETWORKPROTOCOLS=0 SQLACCOUNT="NT AUTHORITY\SYSTEM" SQLBROWSERACCOUNT="NT AUTHORITY\SYSTEM" INSTALLSQLDIR="${SQLDest}" \
INSTALLSQLSHAREDDIR="${SQLDest}" INSTALLSQLDATADIR="${SQLDest}"'
ExecWait '$INSTDIR\Tools\SQLEXPR_Toolkit.EXE /qb ADDLOCAL=SQL_WarehouseDevWorkbench,Client_Components,Connectivity,SQL_SSMSEE INSTANCENAME=SQLExpress \
SECURITYMODE=SQL SAPWD=Password SQLBROWSERAUTOSTART=1 DISABLENETWORKPROTOCOLS=0 INSTALLSQLDIR="${SQLDest}" INSTALLSQLSHAREDDIR="${SQLDest}" INSTALLSQLDATADIR="${SQLDest}"'
Continue: