sqlserver2008 Silent-Installed Bat script

Source: Internet
Author: User

Hello everyone:

The following is a sqlserver2008 silent installation of the bat script, copy the following script into the bat file to execute.

1. Extract the installation files to the D:\tool\SQLServer2008_ENU_for_win2008\ directory, or other specified directories, and modify the SourcePath value to the specified path.

2, Save the following bat script execution, PID is the activation code, SAPWD for the SA user password.

3, at the time of writing the script, the first problem is that many parameters of sqlserver2008 and 2005 have a lot of changes, if you still use the 05 Bat script installation will encounter many problems, you can run Setup.exe/help get all the parameter information.

4, then is the parameter value of the problem, set the value of Agtsvcstartuptype to 1 causes an error.

5, the script can be passed the way to get the database character set, such as./install.batkorean_wansung_ci_as, will use the Korean character set.

6, finally, is written similar to/sqltempdbdir= "D:\ms_data" path when you can not write/sqltempdbdir= "D:\ms_data\", so the path is invalid.

7, the Red place is the need for everyone according to their own circumstances to modify the place.

@echo off

Setlocal enabledelayedexpansion

Cls

Set sourcepath=d:\tool\sqlserver2008_enu_for_win2008\

Set sqlcollation=%1

CD%sourcepath%

If not exist "%sourcepath%\setup.exe" (

echo error:not Correct Install File for SQL Server 2008

Pause

Exit

)

echo "Start Install SQLServer2008 ..."

If defined sqlcollation (

%sourcepath%\setup.exe/q/action=install ^

/features=sql,tools ^

/sqlcollation= "%sqlcollation%" ^

/instancename=mssqlserver ^

/pid= "xxxxxxxxxxxxxxx" ^

/sqlsvcaccount= "Ntauthority\system" ^

/sqlsysadminaccounts= ". \administrator" ^

/agtsvcaccount= "NT AUTHORITY\NetworkService" ^

/securitymode= "SQL" ^

/sapwd= "xxxxxxxxxxxxxxxx" ^

/agtsvcstartuptype= "Automatic" ^

/sqlsvcstartuptype= "Automatic" ^

/tcpenabled= "1" ^

/npenabled= "0" ^

/sqltempdbdir= "D:\ms_data" ^

/sqltempdblogdir= "D:\ms_log" ^

/sqlbackupdir= "D:\ms_backup" ^

/sqluserdbdir= "D:\ms_data" ^

/sqluserdblogdir= "D:\ms_log" ^

/iacceptsqlserverlicenseterms

)

If not defined sqlcollation (

%sourcepath%\setup.exe/q/action=install ^

/features=sql,tools ^

/instancename=mssqlserver ^

/pid= "xxxxxxxxxxxx" ^

/sqlsvcaccount= "Ntauthority\system" ^

/sqlsysadminaccounts= ". \administrator" ^

/agtsvcaccount= "NT AUTHORITY\NetworkService" ^

/securitymode= "SQL" ^

/sapwd= "xxxxxxxxxxxxxxxxxxx " ^

/agtsvcstartuptype= "Automatic" ^

/sqlsvcstartuptype= "Automatic" ^

/tcpenabled= "1" ^

/npenabled= "0" ^

/sqltempdbdir= "D:\ms_data" ^

/sqltempdblogdir= "D:\ms_log" ^

/sqlbackupdir= "D:\ms_backup" ^

/sqluserdbdir= "D:\ms_data" ^

/sqluserdblogdir= "D:\ms_log" ^

/iacceptsqlserverlicenseterms

)

echo "finished Install SQL Server 2008"


Set path=%path%; C:\Program Files\microsoftsql server\100\tools\binn\; C:\Program Files\Microsoft SQL Server\100\dts\binn\;

echo "Disable user sa,and createmonitor user XXX"

REM Disabling SA users

Sqlcmd-d "Master"-Q "ALTER LOGIN [SA] DISABLE; Select ' SQL Server init OK ' "

echo "Finished user setting"

Pause

Exit


This article is from the "composer" blog, make sure to keep this source http://zuoqujia.blog.51cto.com/9151800/1544238

sqlserver2008 Silent-Installed Bat script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.