1

I am running a recursive function that activates many features in powershell however I need to find the child feature a feature is dependent on before it is activated. How can I do this in powershell.

Assume all the solutions have been correctly deployed.

1

It sounds like you are looking for the ActivationDependencies of the SPFeatureDefinition object. In SP2010, you would do something like this :

Get-SPFeature | % {
    $feature = $_
    $featureName = $_.DisplayName
    $feature.ActivationDependencies | % {
        $dep = Get-SPFeature $_.FeatureId
        $depName = $dep.DisplayName

        write-output "$featureName,$depName"
    }
}

If you need to do this for SP2007, then This blog post has a good example of how to go about it.

  • A more "PowerShell"'is answer could be Get-SPFeature | Select -ExpandProperty ActivationDependencies – Anders Rask Apr 24 '13 at 9:58
  • Thanks Dave that looks like exactly what I am looking for thanks. – Miyagi Apr 25 '13 at 10:34
  • @AndersRask that shows the dependency IDs but not the features themselves. However, it is a great start for finding the dependency of a single known feature, I slightly modified it to this: get-spfeature PublishingSite | select -expandproperty ActivationDependencies | % { Get-SPFeature $_.FeatureId } – Dave Wise Apr 29 '13 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.