Create Site Collections in Central Admin Tool
The tool for this purpose is quite simple and it isn´t thought for daily creation massively.
For this purpose, we propose one script... This script only requires one existing Web Application and some information...
For this purpose, we propose one script... This script only requires one existing Web Application and some information...
Write-Host "This
script creates one site collection after you provide the information needed for
it." -ForegroundColor Blue
#This part presents the templates and languages for Site Collections
Write-Host "Codes
for templates and languages available"
Get-SPWebTemplate
Get-SPWebTemplate
#This part recollects the information for Site
Collection creation
$WebApp = read-host "Please, introduce the Web Application URL: "
$ContentDatabase = read-host "Please, introduce the Content Database name: "
$ContentDatabase = read-host "Please, introduce the Content Database name: "
#The variable $Sufix is the part of URL after
"/sites/
#Example http://webapplication/sites/sufix
$Sufix = read-host "Please, introduce the site collection sufix: "
$Template= read-host "Please, introduce the Template ID:"
$LocaleID = read-host "Por favor, introduce the Locale ID:"
$Title = read-host "Por favor, introduce the Title:"
$OwnerAlias=read-host "Por favor, introduce the primary administrator(DOMAIN\user):"
$SecondaryOwnerAlias=read-host "Por favor, introduce the secondary administrator(DOMAIN\USER):"
$Template= read-host "Please, introduce the Template ID:"
$LocaleID = read-host "Por favor, introduce the Locale ID:"
$Title = read-host "Por favor, introduce the Title:"
$OwnerAlias=read-host "Por favor, introduce the primary administrator(DOMAIN\user):"
$SecondaryOwnerAlias=read-host "Por favor, introduce the secondary administrator(DOMAIN\USER):"
#This part has two steps.
#First Content Database creation
try
{
Write-Host "Trying to create Content Database... please wait..."
New-SPContentDatabase -Name $ContentDatabase -WebApplication $WebApp -MaxSiteCount 1 -WarningSiteCount 0
#Second Site Collection creation
{
Write-Host "Trying to create Content Database... please wait..."
New-SPContentDatabase -Name $ContentDatabase -WebApplication $WebApp -MaxSiteCount 1 -WarningSiteCount 0
#Second Site Collection creation
Write-Host "Trying
to create the Site Collection... please wait..."
New-SPSite $webApp/sites/$Sufix -OwnerAlias $OwnerAlias –Language $LocaleID -Template $Template -Name "$Title" -SecondaryOwnerAlias
$SecondaryOwnerAlias -ContentDatabase $ContentDatabase
}
catch
{
Write-Host "There was a problem:" $_ -ForegroundColor Red
}
New-SPSite $webApp/sites/$Sufix -OwnerAlias $OwnerAlias –Language $LocaleID -Template $Template -Name "$Title" -SecondaryOwnerAlias
$SecondaryOwnerAlias -ContentDatabase $ContentDatabase
}
catch
{
Write-Host "There was a problem:" $_ -ForegroundColor Red
}
This script don´t create Site Collection at root level (http://webapplication/) but can be tuned for detects it but I don´t want make the article more complicated... I will write about it in next entry...

No hay comentarios:
Publicar un comentario