Identifying Sites using the Publishing Feature

Below is a simple script that iterates through all Site Collections in all Web Applications within a farm and outputs a list of Site Collections that have the Publishing Feature enabled, I needed this recently during a customer engagement to help them to assess how widespread the Publishing Features were being used within their environment. Simply update the output path highlighted and run.

Add-PSSnapin Microsoft.Sharepoint.PowerShell -EA SilentlyContinue
$Output = "C:\Output.txt"
"Site Collections with the Publishing Feature enabled " + (Get-Date) > $Output
"------------------------------------------------------------------------" >> $Output
$WebApps = Get-SPWebApplication
$Feature = Get-SPFeature "PublishingSite"
Foreach ($WebApp in $WebApps) {Foreach($Site in $WebApp.Sites)
{$FeaturePresent = Get-SPFeature -Site $Site | Where {$_.DisplayName -eq $Feature.DisplayName}; if ($FeaturePresent -ne $null){$Site.URL >> $Output}}$Site.Dispose()}

Below is an example of the output.

Brendan Griffin

Comments (0)

Skip to main content