views:

226

answers:

2

I need to deploy a Sql Server Express 2008 database in unattended installation using command line or AutoIt, and I need to :

1.- Set sa password.

2.- Disable built-in\Administrators account to deny login.

3.- Attach a database with all users accounts enabled.

Thx

A: 

For SA password, see How to: Install SQL Server 2008 from the Command Prompt: /SAPWD Specifies the password for the SQL Server sa account.

You can chose integrated or mixed authentication mode for the install (see /SECURITYMODE in the link above).

To specify the default members of the sysadmin group, use /SQLSYSADMINACCOUNTS. Unless explictly specified, built-in\administrators will not be added as login.

To attach a database, run a post-install script that attaches the database, using CREATE DATABASE database_name FOR ATTACH. To enable users in the newly attached database, explicitly create the users needed with CREATE USER.

Remus Rusanu
Thx., I'am working your in solution
Bitnius
A: 

You could use a configuration file like the example below, then just use a script to attach the databases and the other stuff.

## ---- BEGIN FILE ---- ##

;SQLSERVER2008 Configuration File
;setup.exe /configurationfile="C:\YOURINSTANCENAME.ini"

[SQLSERVER2008]
INSTANCEID="YOURINSTANCENAME"
ACTION="Install"
FEATURES=SQLENGINE,IS
HELP="False"
INDICATEPROGRESS="False"
QUIET="False"
QUIETSIMPLE="False"
X86="False"
PCUSOURCE="C:\SQLServer2008Std_FullSP1\PCU"
ERRORREPORTING="False"
INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server"
INSTANCEDIR="D:\SQL"
SQMREPORTING="False"
INSTANCENAME="YOURINSTANCENAME"
AGTSVCACCOUNT="DOMAIN\YOURSERVICEACCOUNT"
AGTSVCSTARTUPTYPE="Automatic"
ISSVCSTARTUPTYPE="Automatic"
ISSVCACCOUNT="NT AUTHORITY\NetworkService"
SQLSVCSTARTUPTYPE="Automatic"
FILESTREAMLEVEL="0"
SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS"
SQLSVCACCOUNT="DOMAIN\YOURSERVICEACCOUNT"
SQLSYSADMINACCOUNTS="DOMAIN\DBA"
SECURITYMODE="SQL"
ADDCURRENTUSERASSQLADMIN="False"
TCPENABLED="1"
NPENABLED="1"
BROWSERSVCSTARTUPTYPE="Automatic"
AGTSVCPASSWORD="YOURPASSWORD"
SQLSVCPASSWORD="YOURPASSWORD"
SAPWD="YOURPASSWORD"

## ---- END FILE ---- ##
Jason Cumberland
Thx., I'am working your in solution too.
Bitnius