Thursday, February 27, 2014

Use Full PowerShell Script for SharePoint


PowerShell Script for Activate Publishing Feature for All Sites


$siteUrl = "<Site url>"
$siteCollection = Get-SPSite $siteUrl
# iterate to all SPWeb (sub sites).
$siteCollection | Get-SPWeb -limit all | ForEach-Object{
write-host "Activating the PublishingWeb feature on " $_.Url
#Enable PublishingWeb Feature and the internal name of the SharePoint Server Publishing feature
Enable-SPFeature -Identity "PublishingWeb" -Url $_.Url
write-host "Activated the PublishingWeb feature on " $_.Url
}
$siteCollection.Dispose()

1 comment: