# #本文档所有安装操作都使用自动化脚本
----
# # #安装脚本的参数
```
#!set
[Email protected]//SA database password
Sqlcomponent=sqlengine,replication,fulltext,conn,bc,sdk,ssms,adv_ssms,snac_sdk,ocs//Mounting components
Collation=arabic_bin//Sorting rules
installsqldatadir=c:///default installation directory
Sqlsysadminaccounts=.\administrator//Local account
```
# # #安装脚本
```
#!cmd
7z X-o${basedir}-y%this. install_url% > NUL//Unzip the installation package
#!ant//Replace installation parameters and replace SQL Server's interactive answer file with an ant script
<replace encoding= "UTF-8" dir= "${basedir}" >
<include name= "**/*.ini"/>
<replacefilter token= "@[email protected]" value= "%this.sqlcomponent%"/>
<replacefilter token= "@[email protected]" value= "%this.collation%"/>
<replacefilter token= "@[email protected]" value= "%this. installsqldatadir% "/>
<replacefilter token= "@[email protected]" value= "%this. sqlsysadminaccounts% "/>
</replace>
#!cmd//Execute the installation script, execute the path of the interactive answer file, specify the sa password
CD cn_sql_server_2008_r2_enterprise_x86_x64_ia64_dvd_522233
setup.exe/q/action=install/configurationfile= "Standalone.ini"/sapwd=%this.sapassword%
#!ant//Delete all Files
<delete >
<fileset dir= "${basedir}" includes= "**/*.*"/>
</delete>
```
# # #sql交互应答文件 ' Standalone.ini '
```
; SQLSERVER2008 Configuration File
[SQLSERVER2008]
Instanceid= "MSSQLSERVER"
action= "Install"
Iacceptsqlserverlicenseterms= "True"
[Email protected]@
help= "False"
Indicateprogress= "True"
quiet= "True"
Quietsimple= "False"
x86= "False"
enu= "False"
Errorreporting= "False"
installshareddir= "C:\Program Files\Microsoft SQL Server"
Installsharedwowdir= "C:\Program Files (x86) \microsoft SQL Server"
instancedir= "C:\Program Files\Microsoft SQL Server"
Sqmreporting= "False"
Instancename= "MSSQLSERVER"
Agtsvcaccount= "NT authority\network SERVICE"
Agtsvcstartuptype= "Manual"
Issvcstartuptype= "Automatic"
issvcaccount= "NT AUTHORITY\NetworkService"
Assvcstartuptype= "Automatic"
Ascollation= "@[email protected]"
Asdatadir= "Data"
Aslogdir= "Log"
Asbackupdir= "Backup"
Astempdir= "Temp"
Asconfigdir= "Config"
asprovidermsolap= "1"
farmadminport= "0"
Sqlsvcstartuptype= "Automatic"
Filestreamlevel= "0"
enableranu= "False"
Sqlcollation= "@[email protected]"
Sqlsvcaccount= "NT authority\network SERVICE"
Sqlsysadminaccounts= "@[email protected]"
Securitymode= "SQL"
[Email protected]@
Addcurrentuserassqladmin= "False"
tcpenabled= "1"
npenabled= "0"
Browsersvcstartuptype= "Disabled"
Rssvcstartuptype= "Automatic"
Rsinstallmode= "Filesonlymode"
```
----
# #使用说明
Core points in the installation script, the installation script similar to '%this.sqlcomponent% ' is used to replace the variables defined in the installation parameters, and replace the interactive answer file ' Standalone.ini ', and then execute the key script
```
setup.exe/q/action=install/configurationfile= "Standalone.ini"/sapwd=%this.sapassword%
```
After successful installation, use SA password to log into SQL Server Management controller
SQL Server 2008 Installation