Wednesday, August 20, 2014

SharePoint trouble shooting - Remove orphan feature

In the ULS log, the following error message keep happening because the feature has been removed from the solution before the feature undeployed.

Feature definition missing for Feature <<feature display name>>' (Id: '2cf0c09e-157e-4d3b-aa61-fee768b489c9'; CompatibilityLevel: '15')

The following powershell script can be used to identity the orphan features,

$url = "<site url>"
$site= new-Object Microsoft.SharePoint.SPSite($url)
$site.WebApplication.Farm.FeatureDefinitions `
| where-object {$_.solutionid -ne '00000000-0000-0000-0000-000000000000'} `
| Sort-Object solutionid,displayname `
| ft -property solutionid,id, displayname,scope -auto > features.txt
$features = $site.WebApplication.Farm.FeatureDefinitions | where-object {$_.Scope -eq $null} | Sort-Object solutionid,displayname
$features | foreach {
 $id = $_.Id
}
$site.Dispose()

In codeplex, there is a good tool to remove the feature,
http://featureadmin.codeplex.com/

Just download it and use it the remove the orphan feature.




No comments: