Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Show a feature witch is disabled in all SiteCollection

$
0
0

Hello Guys

First - I'm not a Developer :)

I try to find all SiteCollection in a WebApplication where a custom Feature isnot activated.

With copy & paste from WWW and my brain I have now a PowerShell Skript which shows all SiteCollection where the custom Feature is activated. - Well that's nice... but this is the opposite from the requirement :)

I need all SiteCollection where the custom Feature ($FeatureName) is not activated.

Here is my Script:

Add-PsSnapin Microsoft.SharePoint.PowerShell

# INPUT PARAMETERS ###############

#Get WebApplication to look for disabled feature
$webapp = "<WebURL>"

#Look for feature
$FeatureName = "DocId"

################################

$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath

$results = @()

$webapp | Get-SPSite -Limit All | % {
    $siteCol = $_.RootWeb.Url

    Get-SPFeature -Site $_ -Limit All | Where-Object {$_.DisplayName -eq "$FeatureName"} | % {

        $obj = New-Object PSObject;
        $obj | Add-Member NoteProperty Title $($_.DisplayName)
        $obj | Add-Member NoteProperty Url $($siteCol)
        $obj | Add-Member NoteProperty Type "Site Feature"
        $obj | Add-Member NoteProperty Status $($_.Status)

        $results += $obj

    }
    }

    $results | export-csv -path "$dir\Output $FeatureName.csv" -NoTypeInformation

Any ideas?

Cheers Frank







Viewing all articles
Browse latest Browse all 7589

Trending Articles