Skip Ribbon Commands Skip to main content

SharePoint Happenings

Help (new window)
Sign In
Navigate Up
Get Microsoft Silverlight
Install Silverlight plugin for a richer experience...
Blog Home |  Freeware |  Speaking |  About me

Create a new Web Application and Site Collection with Powershell



Bookmark and Share

Top Tech Links










Top SharePoint Administrator Links









Top SharePoint Developer Links













NOTE: This blog has been moved to http://blog.philwicklund.com. If you'd like assistance, leave a comment on the copied post in the new location (hint, use search on the right to find the post).


Below is a simple PowerShell script you can use to create a new Web Application and thereafter a new Site Collection in that web app:

 

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue" | Out-Null

    

$name = "SharePoint 2010 Intranet"

$port = 80

$url = "http://intranet.philsdevdomain.com"

$appPoolName = "SharePointAppPool"

$appPoolAccount = Get-SPManagedAccount "philsdevdomain\spservice"

$databasename = "SharePoint_Intranet_Content_001"

 

New-SPWebApplication

-Name $name

-Port $port

-HostHeader $HostHeader

-URL $url

-ApplicationPool $appPoolName

-ApplicationPoolAccount $appPoolAccount

-DatabaseName $databasename

 

$scOwner = "philsdevdomain\phil"

$template = "STS#1"

 

New-SPSite -URL $url -Name $name -OwnerAlias $scOwner -Template $template

 

Remove-PSSnapin Microsoft.SharePoint.Powershell

 

Note: New-SPWebApplication will need to be on one line, and "STS#1" represents "Blank Site"