Installing SQL Server from Command line(CMD)

How often do you Install SQL Server in your Environment?? Monthly Once? In that case, I prefer just double clicking setup.exp in my installation media and follow the instructions from GUI. How about Weekly Once? Well, i would go with GUI again…considering the time i’ve for completing the task..What if you got a new SQL Farm where you are assigned with a task to Install SQL Server on all your Non Prod environments in a single day or two..Assuming you’ve DEV,SIT and UAT as your Non-Production environments and you’ve to install 8-10 Instances on a single day, i strongly prefer installing SQL Server from command line. It might be little annoying initially, but believe me you’ll be saving 65-70% of your precious time just by providing few parameters to your setup.exe from cmd line. Basically you’ll be skipping all the screens in GUI where you are supposed to provide all the required information through out the installation process.  Let me show you what exactly I’m saying….

I’ve inserted my Installation Media(actually mounted my ISO using Deamon Tools) in my DVD drive and navigated to setup.exe from cmd(Run as Administrator). You can enter SETUP.EXE /? if you want to know all the available Options and Switches which you can make use of in this Installation as shown below.

Before proceeding any further, this is my game plan for Installation:

SQL Server 2008 DB Engine, No SSRS, no SSAS, no SSIS, no Tools(SSMS/BIDS). FYI…My Laptop already has 2 SQL 2008R2 Instances and 1 DENALI Instance….So I’m limiting my installtion with just SQL Server 2008 DB Engine.

InstanceName: SQL2008

SQLSVCACCOUNT (Service Account for DB engine): NT Authority\System

AGTSVCACCOUNT (Service account for SQL Agent): NT Authority\System

SQLSYSADMINACCOUNTS: Sysadmins on SQL Server. I’ll add myself here.

Features: SQL(This implies Just DB Engine, If you want to Install SSIS, SSRS, SSAS as well on the same server – which you should never do; you can enter IS, RS and AS as well)

SECURITYMODE: Windows Authentication/SQL Authentication – I’ll choose SQL in this demo.

SQLUSERDBDIR, SQLUSERDBLOGDIR, SQLTEMPDBDIR are pretty much self explanatory.

So, combining all together my syntax would become

All i did was just navigating to G:\(MY DVD Drive) and typed(ctrl+c and Ctrl+v 😉 from my scripts toolbox) the below and just hit ENTER on my Keyboard!!

setup.exe /QUIETSIMPLE /ACTION=install /FEATURES=SQL /INSTANCENAME=SQL2008 /SQLSVCACCOUNT=”NT Authority\System” /SQLSYSADMINACCOUNTS=”sreekanthpc\sreekanth” /AGTSVCACCOUNT=”NT Authority\System” /SECURITYMODE=SQL /SAPWD=”Pa$$w0rd” /SQLTEMPDBDIR=”D:\SQL2008\TempDB\\” /SQLUSERDBDIR=”D:\SQL2008\SQLData\\” /SQLUSERDBLOGDIR=”D:\SQL2008\SQLLog\\”

I’m welcomed with the installation progress(you can see screenshot below)

After 4 minutes I was returned to the main command prompt without any issues…and you can also see my Config manager with our new Instance(SQL2008) being successfully installed in the below Screenshots

Perfecttttttttt……..:) We avoided all the PAUSE and halts which we usually face while Installing from GUI. At this point, even if you want to change any service accounts or even Data/Log file locations, It’s Just matter of few minutes…. from our config manager!! So..all you need to do is Just save the above Syntax somewhere in your documentation and you can Just Copy Paste by changing the required parameters such as Instance name, Service accounts…etc as needed. Having a standard Drive(s) naming conventions and standard Drive Letters across your enterprise on your SQL Servers makes this process much simple as you can see!

Hope this is useful and you’ll start exploring this if you haven’t yet!!


					
Advertisements

4 comments

  1. I am trying to make an automated installer of SQL 2008R2. My end goal is to install everything to a second drive IE the D drive. I can get it to work on without listing the paths but when I add the paths it will start the installer but then crashes out with no error or log in the command prompt, any ideas?

    SQLEXPRWT_x64_ENU.exe /QS /INDICATEPROGRESS /ERRORREPORTING=1 /action=install /FEATURES=SQL,TOOLS /instancename=Asigra /sapwd=Th3@rchive /SQLSVCACCOUNT=Asigra /SQLSVCPASSWORD=Th3@rchive /ASSVCACCOUNT=Asigra /ASSVCPASSWORD=Th3@rchive /SQLTEMPDBDIR=”D:\SQL2008\TempDB\\” /SQLUSERDBDIR=”D:\SQL2008\SQLData\\” /SQLUSERDBLOGDIR=”D:\SQLLog\\” /IACCEPTSQLSERVERLICENSETERMS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s