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 Answer 1

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.

3
  • A more "PowerShell"'is answer could be Get-SPFeature | Select -ExpandProperty ActivationDependencies Commented Apr 24, 2013 at 9:58
  • Thanks Dave that looks like exactly what I am looking for thanks. Commented Apr 25, 2013 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 } Commented Apr 29, 2013 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.