PS1文件
Write-Host
if($args) {
$SiteName = $args[0]
$SiteUrl = "http://win2k8r2/sites/" + $SiteName
Write-Host "Begin creating SPS2010 site at" $SiteUrl
Write-Host
$NewSite = New-SPSite -URL $SiteUrl -OwnerAlias Administrator -Template STS#1 -Name $SiteName
$RootWeb = $NewSite.RootWeb
$RootWeb.Title = "My SPS2010 Site: " + $SiteName
$RootWeb.Update()
Write-Host "New Contoso site successfully created"
Write-Host "-------------------------------------"
Write-Host "Title:" $RootWeb.Title -foregroundcolor Yellow
Write-Host "URL:" $RootWeb.Url -foregroundcolor Yellow
Write-Host "ID:" $RootWeb.Id.ToString() -foregroundcolor Yellow
}
Else {
Write-Host "ERROR: You must supply Name as parameter when calling CreateSite.ps1"
}
Write-Host