Sample PowerShell script to create web application and a site collection in SharePoint 2013
Views (983)
Just sharing a sample script that we are using to create a web application and a site collection of type publishing in it.
# SharePoint cmdlets Add-PsSnapin Microsoft.SharePoint.PowerShell</pre> # Set variables $WebAppName = "MyAppPool" $WebAppHostHeader = "servername" $WebAppPort = "portnumber" $url = "http://servername" $WebAppAppPool = "MyAppPool" # This User has to be a Sharepoint Manager Account $WebAppAppPoolAccount = "domain\username" $AuthenticationMethod = "NTLM" $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos # Create a new Sharepoint WebApplication New-SPWebApplication -Name $WebAppName -Port $WebAppPort -HostHeader $WebAppHostHeader -URL $url -ApplicationPool $WebAppAppPool -ApplicationPoolAccount (Get-SPManagedAccount $WebAppAppPoolAccount) -AuthenticationMethod $AuthenticationMethod -AuthenticationProvider $ap # Set variables $SiteCollectionName = "MySiteCollection" $SiteCollectionURL = "http://servername:portnumber/" $SiteCollectionTemplate = "BDR#0" $SiteCollectionLanguage = 1033 $SiteCollectionOwner = "LSS\lssspadmin" # Create a new Sharepoint Site Collection New-SPSite -URL $SiteCollectionURL -OwnerAlias $SiteCollectionOwner -Language $SiteCollectionLanguage -Template $SiteCollectionTemplate -Name $SiteCollectionName
Hope it helps ..
Filed under: SharePoint, SharePoint 2010, SharePoint 2013 Tagged: SharePoint, SharePoint 2010, SharePoint 2013
This was originally posted here.

Like
Report
*This post is locked for comments