Home > Articles > Data > SQL Server

  • Print
  • + Share This
From the author of

Defining the Header Information for the Script

The code listing in Listing 1 shows the basic "header" for our script file; that is, the comments and general information about our script.

Listing 1—Basic Header Information for Our Script Files.

@echo off
REM *********************************************************************************************
REM  Code provided by InformIT (http://www.informit.com) as part of a series of articles
REM  Script Name:      InstallSQLServer.bat
REM  Script Purpose:     Installs Microsoft SQL Server 2000.
REM  Version:        1.1
REM  Last Updated By:    Rob Hawthorne on 29th Dec 2002
REM  Version Info:      Updated the script to take the Port details
REM  Notes:  This installation can be modified to NOT install all of the tools by default. 
REM      Has the capability of separating the data and program files from each other.
REM      SQL Server can be installed to run under a restricted user account, i.e. Service Account
REM      this is a recommended configuration (use of service accounts)
REM  Usage:  Used to perform a custom install of SQL Server 2000.
REM      Designed to be used again and again on differing hardware and configurations.
REM  Input Values:
REM  SQLPath    - The path where the program files for SQL Server are installed
REM          e.g., %PROGRAMFILES%\Microsoft SQL Server
REM  SQLsaPwd    - The password for the sa account. Note the .iss file encrypts this
REM          e.g., password
REM  CompanyName  - The registered name of the company
REM          e.g., Microsoft
REM  MixedMode   - (Optional) Specifies whether the installation will used mixed authentication
REM          or Windows only authentication
REM          e.g., Yes or No
REM          - Default Value = No
REM  AppPath	    - Path to SQL Server installation files. Should be a mapped drive path rather than UNC
REM          e.g., Y:\sql2k.std\x86\setup
REM  SvcActName   - (Optional) The service account name that SQL server runs under
REM          e.g., ServiceSQL
REM          - Default Value = LocalSystem
REM  SvcActDom   - (Optional if SvcAcctName is not supplied). The domain name of 
REM          where the server account resides
REM          e.g., MSFT
REM  SvcActPwd   - (Optional if SvcAcctName is not supplied) The password for 
REM          the service account. Note the .iss file encrypts this
REM          e.g., 097f738fb19d058f27b5
REM  SQLDataPath  - (Optional) The path where the data and transaction files for SQL Server are installed
REM          e.g., %PROGRAMFILES%\Microsoft SQL Server\MSSQL\Data
REM          - Default Value = SQLPath
REM  SQLCollation  - (Optional) The coallation settings (for compatibility with earlier versions of SQL)
REM          e.g., SQL_Latin1_General_CP1_CI_AS
REM          - Default Value = SQL_Latin1_General_CP1_CI_AS
REM  InstanceName  - (Optional) The name of the instance you wish to install SQL under. If any other name 
REM          than MSSQLSERVER is specified it is treated as a second instance
REM          e.g., MSSQLSERVER
REM          - Default Value = MSSQLSERVER
REM  TCPPort    - (Optional) The port you wish SQL server to listen for requests on
REM          e.g., 1433
REM          - Default Value = 1433
REM  ISSDir     - (Optional) Complete path to the directory where you want the .iss file created
REM          e.g., %SYSTEMDRIVE%\Temp
REM          - Default Value = %TEMP%
REM  LogFile    - (Optional) Full path and file name to log output messages to
REM          e.g., %SYSTEMDRIVE%\SQLInstall.log
REM          - Default Value = %TEMP%\SQLInstall.log
REM  LicenseMode  - (Optional) The mode for licensing SQL Server with
REM          e.g., PERDEVICE
REM          - Default Value = PERDEVICE
REM  LicenseLimit  - (Optional) The number of licenses purchased for SQL Server
REM          e.g., 1
REM          - Default Value = 1
REM  Output Values:
REM  RetVal    - Return value indicating whether the script has succeeded (0) or not (<> 0)
REM          e.g., RETVAL=0
REM *********************************************************************************************

This header information makes the scripts more maintainable by providing us (or other administrators/developers) with all the referenced parameters, their meanings in the context of the script, a sample value for the parameter, and a section to write notes and version information. You can modify this section as you want; for example, if you or your client has more information they need to capture about the scripts.


You may have noticed the @echo off code line at the very beginning of the script. This line of code turns the echo command (display messages) off. You can toggle this command on and off for debugging purposes, but it usually returns far too much information and only clutters the screen.

  • + Share This
  • 🔖 Save To Your Account