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 found some orphaned features under "_layouts/ManageFeatures.aspx?Scope=Site" but they do not show up when I list them up with powershell (get-spgetfeature -site url). They are not in 14 hive and cannot be found through the "SharePoint Manager".

What can I do to remove these features?

share|improve this question
    
Similar question –  Anatoly Mironov Nov 18 '13 at 15:49
add comment

2 Answers

I have had this problem, too. The reason why they don't show up in PowerShell is the missing Scope, those feature are orphaned, indeed. We cannot use -Site parameter. What you can is to list it in PowerShell without -Site parameter and filter out those without Scope:

Get-SPFeature | ? { $_.Scope -eq $null }

This will give you a complete list of orphaned features.

Obviously, I had a lot of orphaned features on my Development Environment

Now you have to find your feature and delete it. You cannot use Id for getting your feature, neither use Unistall-SPFeature cmdlet with Id:

Uninstall-SPFeature : Cannot find a Feature object with Path or Id: a4d208a3-b4fa-4bca-bb34-be4d30156b63 in scope Local farm. At line:1 char:1 + Uninstall-SPFeature a4d208a3-b4fa-4bca-bb34-be4d30156b63 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Share...ninstallFeature:SPCmdletUninstallFeature) [Uninstall-SPF eature], SPCmdletPipeBindException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletUninstallFeature

The workaround is to use the DisplayName to get the spfeature (actually SPFeatureDefinition) and then delete it.

$feature = Get-SPFeature | ? { $_.DisplayName -eq "My_Orphane_Feature" }
$feature.Delete()

I have tested this code and it has worked for me.

You can even use this code to clean all the orphaned features:

Get-SPFeature | ? { !$_.Scope } | % { $_.Delete() }

This line of code gets all the orphaned features and removes them.

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