$months = "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
#delete the subsites
foreach($month in $months)
{
$w = get-SPWeb
http://ssrap1:8080/NewsRoom/$month
Remove-SPWeb -Identity $w -Confirm
}
#create the subsite for the
newsroom
foreach($month in $months)
{
$SiteTemplate = get-SPWebTemplate | where {$_.Title -eq "Publishing
Site with Workflow"}
$web = New-SPWeb -Url
http://ssrap1:8080/NewsRoom/$month -Name $month -Template $SiteTemplate
Write-Host "`nCreate
SubSite: $web"
$pWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
$i = 0
#create 5 pages
for subsite
Write-Host Createing Pages for $month subsite
while ($i -le 5)
{
$newPage = $pWeb.AddPublishingPage();
$newPage.CheckIn("Checked
in")
$i++
}
$pages = $pWeb.GetPublishingPages()
#approve all
pages
foreach($p in $pages)
{
$p.ListItem.File.Approve("Page
approved automatically by PowerShell script")
}
$web.dispose()
}