-
-
Save princeppy/4d675555584f721efe2d2ef4ded79a83 to your computer and use it in GitHub Desktop.
Powershell: SharePoint 2013 Create Web Application, Root Site Collection,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Replace: | |
# DATABASE | |
# NAMED | |
# APPLICATION NAME | |
# hostheadername | |
# DOMAIN\USER | |
# DOMAIN\SP_FARM_ACCOUNT | |
# PATHNAME | |
# SITE COLLECTION NAME | |
# DIRECTORYPORT | |
# Create Authentication Provider | |
$ap = New-SPAuthenticationProvider | |
# Create Web Application | |
$w = New-SPWebApplication -DatabaseName "WSS_Content_DATABASE" -ApplicationPool "NAMED App Pool" -Name "APPLICATION NAME" -Port 80 -AuthenticationProvider $ap1 -ApplicationPoolAccount (Get-SPManagedAccount 'DOMAIN\SP_FARM_ACCOUNT') -Path "%wwwroot%\wss\VirtualDirectories\DIRECTORYPORT" -HostHeader "hostheadername" | |
iisreset /noforce | |
# Create Root Site Collection | |
$w = Get-SPWebApplication "APPLICATION NAME" | |
New-SPSite http://sub.domain.com -OwnerAlias "DOMAIN\USER" -HostHeaderWebApplication $w -Name "APPLICATION NAME" -Template "BLANKINTERNETCONTAINER#0" | |
# Create Managed Path Site Collection | |
New-SPManagedPath "PATHNAME" -HostHeader -Explicit | |
New-SPSite http://sub.domain.com/PATHNAME -OwnerAlias "DOMAIN\USER" -HostHeaderWebApplication $w -Name "SITE COLLECTION NAME" -Template "BLANKINTERNETCONTAINER#0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment