Wednesday, June 24, 2015

Create SiteCollection Using Powershell

$homeUrl = read-host "Enter WebApplication URL"
$managepath = read-host "Enter site collection relative path here including any managed path. Managed path needs to be existing"
$scName = read-host "Enter site collection name here"
$sitesHomeUrl = $homeUrl + $managepath + "/" + $scName
$primaryOwner = read-host "Enter primary owner account here"
$secondaryOwner = read-host "Enter scondary owner account here"
$contentDatabaseName = read-host "Enter content database name here"
$contentDatabaseServerName = read-host "Enter database server name here"

#Create new content database
New-SPContentDatabase -Name $contentDatabaseName -DatabaseServer $contentDatabaseServerName -WebApplication $homeUrl
#Create new site collection
write-host $sitesHomeUrl;
New-SPSite -Url $sitesHomeUrl -OwnerAlias $primaryOwner -SecondaryOwnerAlias $secondaryOwner -ContentDatabase $contentDatabaseName -Template $templateName

No comments:

Post a Comment

How to launch a document by clicking a link to the file?

Word: <a href='ms-word:ofe|u|path/to/web/word/document.docx'>Link to document</a> Excel: <a href='ms-excel:o...