Web application and site collection
The SP2010 installation that I have used for this series of posts about scripting SP2010 with PowerShell was intended to host a SP2010 internet site. That is why the next to scripts are made to configure a web application and site collection for an internet site. The parameters can also be used to configure web applications and site collections for other purposes.
The script for configuring a web application looks like this:
#Include the SharePoint cmdlets
#Add-PsSnapin Microsoft.SharePoint.PowerShell
#Set the farm variables
$sp_webapp_name = “Internetsite”
$sp_webapp_port = 80
$sp_webapp_hostheader = “www2010″
$sp_webapp_url = “http://www2010”
$sp_webapp_apppool = “www2010AppPool”
$sp_webapp_apppoolaccount = “devnet\xxxxxxx”
$sp_webapp_databasename = “www2010_DB”
$sp_webapp_databaseserver = “DEVNET-R2″
#Create a new Web Application
new-spwebapplication -name $sp_webapp_name -Port $sp_webapp_port -HostHeader $sp_webapp_hostheader -URL $sp_webapp_url -ApplicationPool $sp_webapp_apppool -ApplicationPoolAccount (Get-SPManagedAccount $sp_webapp_apppoolaccount) -DatabaseName $sp_webapp_databasename -DatabaseServer $sp_webapp_databaseserver
Write-Host “Web application is configured”
After you have configured the web application you can take the next step by configuring the site collection:
# Add-PsSnapin Microsoft.SharePoint.PowerShell
# base template values
# Name Title LocaleId Custom
# —- —– ——– ——
# GLOBAL#0 Global template 1033 False
# STS#0 Team Site 1033 False
# STS#1 Blank Site 1033 False
# STS#2 Document Workspace 1033 False
# MPS#0 Basic Meeting Workspace 1033 False
# MPS#1 Blank Meeting Workspace 1033 False
# MPS#2 Decision Meeting Workspace 1033 False
# MPS#3 Social Meeting Workspace 1033 False
# MPS#4 Multipage Meeting Workspace 1033 False
# CENTRALADMIN#0 Central Admin Site 1033 False
# WIKI#0 Wiki Site 1033 False
# BLOG#0 Blog 1033 False
# SGS#0 Group Work Site 1033 False
# TENANTADMIN#0 Tenant Admin Site 1033 False
$sp_sc_template = “BLANKINTERNET#2″
$sp_sc_webappurl = “http://www2010”
$sp_sc_name = “Home”
$sp_sc_language = “1033″
$sp_sc_owner = “devnet\xxxxxxxxx”
new-SPSite -url $sp_sc_webappurl -OwnerAlias $sp_sc_owner -Language $sp_sc_language -Template $sp_sc_template -Name $sp_sc_name
As you can see I used template “BLANKINTERNET#2″ which is not in the base template list shown above. This template is for a Publishing site with workflow. I found this in a blogpost of Todd Baginsky. There you can find a complete list of site templates in SP2010.
After setting up the site collection I have migrated the database of the old website to this new SP2010 farm. Before mounting the database to the new web application I have first tested the database with the following command (see also screenshot below):
Test-SPContentDatabase -Name WSS_Internet_Content -WebApplication Internetsite
The results of the testcommand (shown above) show that there are some features in the old site that where not found on the new SP2010 farm. Because we did not know exactly which features where missing we just tried to mount the database because it was only a test.
Mount the database with the following command:
Mount-SPContentDatabase -Name WSS_Internet_Content -WebApplication Internetsite
At the bottom of the screenshot you can see that mounting the database is in progress.
Part 2: SharePoint 2010 prerequisites
Part 3: SharePoint 2010 server installation
Part 4: Web application and site collection
Tags: beta, installation, powershell, SP2010






One Response to “SharePoint 2010 scripted install with powershell part 4”
Trackbacks/Pingbacks
Leave a Reply