Scripted SharePoint Install

Doing a scripted install of MOSS can save a lot of time, and can also ensure that your installs are consistent.

Below is a sample scripted install of MOSS. (I have changed sensitive information like passwords, emails and URLS.)

I have found that it works best to execute these commands one at a time, rather than as a single script. If you are unlike me and never make mistakes, then feel free to run them all at once. Another added benefit is that this provides very nice documentation of your install for future posterity. And for someone who understands windows scripts can teach quite effectively what it takes to install MOSS, surely much more effectively than the beastly 30 page install instructions on MSDN.

One of my favorite benefits of a scripted install is that you can choose a name for the Central admin content database instead of getting stuck with the ugly content database name the includes a Guid. Some of the setproperty statements at the end are optional, but they give you an idea of how you can customize this script to make sure the same policies are applied across environments.

Credit for these scripts go to Ben Curry.

------------------------------

@echo off
REM //////////////////////////////////////////////////
REM // script farm -- creating dbs and setting sites /
REM //  sharepoint farm.                             /
REM //////////////////////////////////////////////////

REM //////////////////////////////////////////////////
REM // applications
REM //////////////////////////////////////////////////
set s="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe"
set ps="c:\program files\common files\microsoft shared\web server extensions\12\bin\psconfig.exe"

REM //////////////////////////////////////////////////
REM // your enterprise SQL server
REM //////////////////////////////////////////////////
set sql=TOPDEV

REM //////////////////////////////////////////////////
REM // account vars
REM //////////////////////////////////////////////////
set mossfarm=dev\mossfarm
set mosscrawler=dev\mosscrawler
set sspapid=dev\mosswebapp
set myapid=dev\mosswebapp
set sspservice=dev\mossfarm
set portalapid=dev\mosswebapp
set mossservice=dev\mossfarm

REM //////////////////////////////////////////////////
REM // password
REM //   NOTE:if using a % sign in password you must
REM //        escape it with a % sign 'iuyOP%%$#@!11'
REM //        is interpreted as 'iuyOP%$#@!11'
REM //       
REM //////////////////////////////////////////////////
set p=MyPasswordIsSomething

REM //////////////////////////////////////////////////
REM // additional settings
REM //////////////////////////////////////////////////
set sspportalurl=http://ssp.catapultdemo.com:81
set mysiteurl=http://my.catapultdemo.com:81
set portalurl=http://catapultdemo.com:81
set owneremail="joseph at email.com"
set ownername="Joseph Fluckiger"
set ownerlogin="dev\josephf"

REM //////////////////////////////////////////////////
REM // start work here
REM //////////////////////////////////////////////////

GOTO CURRENTSPOT
:CURRENTSPOT

Echo ===============================
Echo == Creating Farm
Echo ===============================
:: Creating Farm via populating the ConfigDB. Set SQL Servername, configDB name, Central Admin ContentDB, and Farm Account.
@pause
%ps% -cmd configdb -create -server %sql% -database SharePoint_Config_TOPDEV -user %mossfarm% -password %p% -admincontentdatabase SharePoint_Content_CentralAdmin
Echo ======================
Echo Provision Central Admin
Echo ======================
::  Provision Central Admin Application on this server. Uses configDB and ContentDB above. Set port number to suit your requirements.
@pause
%ps%  -cmd adminvs -provision -port 5000 -windowsauthprovider onlyusentlm
Echo ======================
Echo Install all Services
Echo ======================
::  Install all services on machine
@pause
%ps% -cmd services install
Echo ======================
Echo Securing File System and Registry Keys
Echo ======================
:: Set Security on File System and Registry Keys
@pause
%ps% -cmd secureresources
Echo ======================
Echo Starting MOSS Search
Echo ======================
::  Start SharePoint Server Search Service.Verify database and services names. Change role to Index, Query, or IndexQuery, depending on your farm topology.
@pause
%s% -o osearch -action start -role Indexquery -farmcontactemail %owneremail% -farmperformancelevel PartlyReduced -farmserviceaccount %mossservice% -farmservicepassword %p%
Echo ======================
Echo Starting WSS Search
Echo ======================
::  Start WSS Search. Verify database and service names.
@pause
%s% -o spsearch -action start -farmserviceaccount %mossservice% -farmservicepassword %p% -farmcontentaccessaccount %mosscrawler% -farmcontentaccesspassword %p% -databaseserver %sql% -databasename SharePoint_WSS_Search
Echo ======================
Echo Installing all Features
Echo ======================
::  Install all features on machine
@pause
%ps% -cmd installfeatures
Echo ======================
Echo Creating My Sites Web
Echo ======================
::  Create My Site Web application. Verify database name and administrator's names.
@pause
%s% -o extendvs -url %mysiteurl% -ownerlogin "%mossfarm%" -owneremail %owneremail% -exclusivelyusentlm -ownername "mossAdmin" -databaseserver %sql% -databasename SharePoint_Content_MySite -sitetemplate spsmsitehost -description "My Site Host" -sethostheader -apidname MySiteAppPool -apidtype configurableid -apidlogin %myapid% -apidpwd %p%
iisreset
Echo ======================
Echo Enabling Self Service Site Management for %mysiteurl%
Echo ======================
::  Enable Self Service Site Management (Creation) on %mysiteurl%
@pause
%s% -o enablessc -url %mysiteurl%
Echo ======================
Echo Creating SSP Web
Echo ======================
::  Create SSP Web application. Verify database and apid names. (APID = Application Pool Identity)
@pause
%s% -o extendvs -url %sspportalurl% -exclusivelyusentlm -databaseserver %sql% -databasename SharePoint_Content_SSP -donotcreatesite -description "SSP Admin Host" -sethostheader -apidname "SSP1" -apidtype configurableid -apidlogin %sspapid% -apidpwd %p%
::  We must reset IIS before building the SSP. If you are local on the box, you can check all services are created before creating SSP.
iisreset
Echo ======================
Echo Creating SSP
Echo ======================
::  Create SSP. Verify all names and URLs.
@pause
%s% -o createssp -title "SSP1" -url %sspportalurl% -mysiteurl %mysiteurl% -ssplogin %sspservice% -indexserver topdev -indexlocation "C:\Program Files\Microsoft Office Servers\12.0\Indexes" -ssppassword %p% -sspdatabaseserver %sql% -sspdatabasename SharePoint_SSP1_Config -searchdatabaseserver %sql% -searchdatabasename SharePoint_SSP1_Search -ssl no
Echo ======================
Echo Creating Portal
Echo ======================
::  Creating Portal.
@pause
%s% -o extendvs -url %portalurl% -ownerlogin %ownerlogin% -owneremail %owneremail% -ownername %ownername% -exclusivelyusentlm -databaseserver %sql% -databasename SharePoint_Content_catapultdemo -sitetemplate STS#1 -description "Catapult Demo Portal" -sethostheader -apidname "MossWebAppPool" -apidtype configurableid -apidlogin %portalapid% -apidpwd %p%
REM //////////////////////////////////////////////////
REM // POST BUILD
REM //////////////////////////////////////////////////
Echo ========================
Echo Modifying Logging level
Echo and Outbound Smtp
Echo ================calling setlogs.cmd====see premium content for xlsx source file=======
REM  or just set the logging levels in this script
@pause
%s% -o setlogginglevel -category general -tracelevel unexpected -windowslogginglevel error
%s% -o email -outsmtpserver topdev -fromaddress %owneremail% -replytoaddress %owneremail% -codepage 65001

Echo ========================
Echo Setting Application Settings
Echo Setting Recycle Bin Settings
Echo ========================
@pause
%s% -o setproperty -pn recycle-bin-enabled -pv yes -url %portalurl%
%s% -o setproperty -pn recycle-bin-enabled -pv yes -url %mysiteurl%
%s% -o setproperty -pn recycle-bin-retention-period -pv 180 -url %portalurl%
%s% -o setproperty -pn recycle-bin-retention-period -pv 180 -url %mysiteurl%
%s% -o setproperty -pn second-stage-recycle-bin-quota -pv 20 -url %portalurl%
%s% -o setproperty -pn second-stage-recycle-bin-quota -pv 20 -url %mysiteurl%

Echo ========================
Echo Setting Maximum Upload
Echo File Size
Echo ========================
@pause
%s% -o setproperty -pn max-file-post-size -pv 200 -url %portalurl%
%s% -o setproperty -pn max-file-post-size -pv 200 -url %mysiteurl%

Comments

Unknown said…
Awesome post. Just what I was looking for
Unknown said…
Hi, Thanks for your interesting blog. Keep up the great work! I also have a site & blog about Microsoft SharePoint developers, please feel free to visit.

Popular posts from this blog

RAM Disks do not speed up Visual Studio

SpreadsheetGear vs. SyncFusion vs. ComponentOne

Outlook tip: Turn off Email Contact Pictures