Skip to content

Instantly share code, notes, and snippets.

@devendrasv
Last active December 16, 2015 01:38
Show Gist options
  • Save devendrasv/eaed17f9c4e1d0e2ecfc to your computer and use it in GitHub Desktop.
Save devendrasv/eaed17f9c4e1d0e2ecfc to your computer and use it in GitHub Desktop.
#Example of getting site collection url based on feature Name
Add-PSSnapin Microsoft.SharePoint.PowerShell
$webapp= Get-SPWebApplication "http://www.sharepoint-journey.com/"
# looping through all sitecollections
foreach($site in $webApp.Sites)
{
#Get the feature based on display name
$feature=Get-SPFeature -Site $site | Where-object {$_.DisplayName -eq "Branding"}
if($feature -ne $null)
{
# Disply the site site collection URL
Write-host "Feature Activated at" $site.Rootweb.URL
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment