Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

How to perform a command line installation of SQL Server 2005

How to perform a command line installation of SQL Server 2005

  • Comments 6

I was asked by a customer a while back about available options for performing silent installation of SQL Server 2005 Express Edition.  I haven't had a lot of time to research this issue, and the only steps I knew were the ones used by Visual Studio setup to install SQL Express.

Now that I looked into this scenario a bit more, I found an MSDN document entitled How to: Install SQL Server 2005 from the Command Prompt that provides in-depth instructions regarding supported command line switches for SQL 2005 setup and steps for creating an automated installation answer file.

The instructions in this document will allow you to perform all of the following configuration tasks, plus several more that I didn't list:

  • Install a standalone SQL instance
  • Install a clustered SQL instance
  • Rebuilding SQL databases
  • Add/remove individual components
  • Add/remove nodes in a cluster
  • Uninstall a standalone SQL instance
  • Uninstall a clustered SQL instance

Please note that these instructions are generic and apply to all versions of SQL Server 2005.  Some of the advanced configuration options are not supported by SQL Server 2005 Express Edition, so you will need to make sure to only attempt to install the Express Edition using switches and options that it supports.

 

  • Ever tried a SQL Express installation with command line options, launched from the RunOnce registry key?  Or launched using the CreateProcess API call from a process that was launched from the RunOnce key?

    Interestingly, I found that sqlexpr32.exe, the SQL Express setup application totally ignores its command line options when the start of the process tree it is part of is launched from RunOnce.

    The only way I found to get it to pay attention to the command line options was the use ShellExecute, instead of CreateProcess.

    Strange.

    Try it - Add the following to the RunOnce key:

    sqlexpr32.exe -q /norebootchk /qn reboot=ReallySuppress addlocal=all instancename=SQLEXPRESS SQLAUTOSTART=1

    Should perform a silent install, but the UI will show up!  Run the same thing from the command prompt, and it will be silent.

    Don't know if the same applies to the SQL Server installer.
  • Hi Qisope - I haven't heard of this issue before, but I had another customer post about a similar experience at http://blogs.msdn.com/astebner/archive/2006/03/19/555326.aspx#605285.  I don't know whether or not this is intentional for SQL setup to behave that way, but I would suggest reporting this as a bug on the Product Feedback site (http://lab.msdn.microsoft.com/productfeedback) and see what the SQL team has to say about this scenario.

    In the meantime, you might want to try to launch SQL setup using a wrapper batch file that you call from the RunOnce registry key and see if that can be used as a workaround.  Please let me know how it goes by posting a follow-up comment if you see this....
  • PingBack from http://blogs.msdn.com/astebner/articles/574618.aspx
  • This guide is intended to serve as a collection of links to articles, tools, tips and tricks that explain

  • Hi,

    I am trying to install SQL Server 2008 R2 Native Client at custom location.

    For this I tried various approaches:

    1. Installing by double clicking the msi:

    In the installer screen browse button is disabled and it's not possible to provide custom installation path.

    2. Command line instruction:

    - msiexec /i sqlncli_x64.msi /qb  /lv %1 INSTALLSHAREDDIR=%3 FEATURE=SQL_SNAC_CORE,SQL_SNAC_SDK IACCEPTSQLNCLILICENSETERMS=YES

    where %3 is the user specified custom installation path.

    Even after specifying the custom path, the Native Client is getting installed at the default path only. (<program files>\Microsoft SQL Server\).

    - I also tried executing the following command but this too is not working:

    msiexec /i “<MSI Path>” INSTALLDIR= “<Custom Path>”

    When I installed the SQL Server Native Client through SQL Server Installer by providing custom path on the features selection page, the Native Client got installed at custom location.

    As SQL Server installer is able to do it, there should be some parameter through which it provides custom path to the Native Client installer.

    Please let me know if there is any such parameter or any other way to install SQL Server 2008 R2 Native Client at custom location.

    Thanks & regards,

    Apeksha

  • Hi Apeksha - I don't have enough expertise in how SQL Server setup works to be able to answer this question.  I'd suggest posting a question on the SQL Server Setup forum at social.msdn.microsoft.com/.../threads and hopefully someone there will be able to help.

Page 1 of 1 (6 items)
Leave a Comment
  • Please add 8 and 5 and type the answer here:
  • Post