Creating a new web Application, Site and Subsite using PowerShell
Creating a new web Application
A little short on time this month but here is a very quick and a very to the point post on how to create a new web application, with a site collection, and a site…
Create a new variable for the authentication provider, and to use windows authentication.
$ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
Then we can create a new web Application, Note please remove the [ ] from the greater than characters[>]
New-SPWebApplication -Name "SharePoint - 80" -Port 80 -URL http://SITE -ApplicationPool "SharPoint - 80" -ApplicationPoolAccount [<]Get-SPManagedAccount "DOMAIN\SP_ADMIN"[>] -AutheicationProvider $ap
Create a site collection for the new web application
Before we start this process a little help woudln't go a miss, to see what is on offer... type;
To have a look at all the templates on offer...
for this example we are going to use a team site and template id for a team site is "STS#0"
To create a template, lets start with setting a variable..
$template = Get-SPWebTemplate "STS#0"
you now have a template in the variable and we can create a site
New-SPSite -Url "http://SITE/SITECOLLECTION" -OwnerAlias "DOMAIN\SP_ADMIN" -Template $template
Creating a subsite
To create an addtional subsite
New-SPWeb "http://SITE/SUBSITENAME" -Template "STS#0"
To remove a web application