Blog Post

Silent Install

,

A few weeks a go I presented at OSQL-D in Portland, OR, and a lot of people ask me if I could send it to them.  I have decided to post the script here.  You could just copy and past the statement into a note pad and save it as 08R2Install.cmd file. There are a few other set up that you will need to do before you could run this file.

1.Enable/create demouser account so that sql server could use it to start sql service.  In my script I use demo account, because this is for demo.  You should use some other account that make sense in your environment.  This account should not have any special priviledge.

2.Mount new drive using Sql server 2008 R2 available iso to F drive.  This script should work with MSDN and other commercial license.  I have not test it on Express because I don't want to put Express on my laptop.  If you use it to install Express version, you might have different experience.  If F drive is already taken, point it to something else and change the script to point to that new drive.

3.You might want to change so that  all your sql service are auto start.  I like to keep it on manual mode because I don't always need to use SQL Server when I start my laptop.

-------------------Beging of Script------------------------------------

echo off
:: --------------------------------------------------------------------
:: file : 08R2Install.cmd
:: Purpose   : Install a new instance
:: Created   : Sopheap Suy        2010-10-28
:: Parameters:
::        %1: New instance name to create
::        %2: SA password for new instance
::        %3: SqlServiceAct password
::
:: Feature Install: SQLEngine, Replication, FullText, Tools, SSIS and BIDS, File Stream
::
:: Sample command line call:
::        08R2Install.cmd YourNewInstanceNameHere YourSAPasswordHere YourSQLServerServiceAccountPasswordHere
::
:: NOTE:
::        This script should be run from an RDP session on the server to receive the new instance,
::        NOT your local workstation.
::
:: Reference for unattended installs is at:
::         http://msdn2.microsoft.com/en-us/library/ms144259.aspx
::
:: --------------------------------------------------------------------
if "%1"=="" GOTO Abort
if "%2"=="" GOTO Abort
if "%3"=="" GOTO Abort

SET InstanceName=%1
SET SAPassword=%2
SET SqlServiceActPassword=%3

:: --------------------------------------------------------------------
:: Install new instance
:: --------------------------------------------------------------------
F:\setup.exe /Qs ^
    /ACTION=Install ^
    /ADDCURRENTUSERASSQLADMIN=false ^
    /INSTANCENAME="%InstanceName%" ^
    /FEATURES=SQLEngine,Replication,FullText,Tools,IS,ADV_SSMS ^
    /FILESTREAMLEVEL=2 ^
    /FILESTREAMSHARENAME="%InstanceName%" ^
    /INSTANCEDIR="C:\Program Files\Microsoft SQL Server\%InstanceName%" ^
    /SQLUSERDBDIR="C:\Program Files\Microsoft SQL Server\%InstanceName%" ^
    /SQLUSERDBLOGDIR="C:\Program Files\Microsoft SQL Server\%InstanceName%" ^
    /SQLBACKUPDIR="C:\Program Files\Microsoft SQL Server\%InstanceName%" ^
    /SQLTEMPDBDIR="C:\Program Files\Microsoft SQL Server\%InstanceName%" ^
    /SQLTEMPDBLOGDIR="C:\Program Files\Microsoft SQL Server\%InstanceName%" ^
    /SECURITYMODE=SQL ^
    /SAPWD="%SAPassword%" ^
    /SQLSYSADMINACCOUNTS=".\demouser" ^
    /SQLSVCACCOUNT=".\demouser" ^
    /SQLSVCPASSWORD="%SqlServiceActPassword%" ^
    /AGTSVCACCOUNT=".\demouser" ^
    /AGTSVCPASSWORD="%SqlServiceActPassword%" ^
    /SQLSVCSTARTUPTYPE=Manual ^
    /AGTSVCSTARTUPTYPE=Manual ^
    /IACCEPTSQLSERVERLICENSETERMS

if ERRORLEVEL 1 GOTO Abort

GOTO Finish

:Abort
echo ============================================ Batch Aborted.  >> %LogFile%

:Finish

------------------------Ending of Script------------------------------

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating