In SharePoint 2010 you can manage site collections through Windows PowerShell. You can create new site collections using the New-SPSite cmdlet:
-Template “STS#0”
You can retrieve an existing site using the Get-SPSite cmdlet:
You can configure a site collection through the Set-SPWeb cmdlet:
And finally, you can remove a site collection using the Remove-SPSite cmdlet:
Setting the –Confirm switch parameter to $false omits the confirmation returned from PowerShell. If you want to see what happens if you remove a site collection but don’t want to actually remove the site collection you can use the –WhatIf switch parameter.
The Cmdlet
New-SPSite [-Url]
The Script
$siteURL = “http://prod.moss.com”
$owner = “ds\admmoss”
$secondOwner = “ds\kumar”
$template = “STS#0″
$description = “This is a sample site that was built using PowerShell.”
New-SPSite $siteURL -OwnerAlias $owner -SecondaryOwnerAlias $secondOwner -name “PowerShell for SharePoint” -Template $template-Description $description
Comments
Post a Comment