Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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