This article describes the missing feature issue occurred after migration
You will see the below type of errors in CA monitoring
MissingFeature....
Solution
Run the below cmd in powershell on the sharepoint server
function Remove-SPFeatureFromContentDB($ContentDb, $FeatureId, [switch]$ReportOnly)
{
$db = Get-SPDatabase | where { $_.Name -eq $ContentDb }
[bool]$report = $false
if ($ReportOnly) { $report = $true }
$db.Sites | ForEach-Object {
Remove-SPFeature -obj $_ -objName "site collection" -featId $FeatureId -report $report
$_ | Get-SPWeb -Limit all | ForEach-Object {
Remove-SPFeature -obj $_ -objName "site" -featId $FeatureId -report $report
}
}
}
function Remove-SPFeature($obj, $objName, $featId, [bool]$report)
{
$feature = $obj.Features[$featId]
if ($feature -ne $null) {
if ($report) {
write-host "Feature found in" $objName ":" $obj.Url -foregroundcolor Red
}
else
{
try {
$obj.Features.Remove($feature.DefinitionId, $true)
write-host "Feature successfully removed from" $objName ":" $obj.Url -foregroundcolor Red
}
catch {
write-host "There has been an error trying to remove the feature:" $_
}
}
}
else {
#write-host "Feature ID specified does not exist in" $objName ":" $obj.Url
}
}
Remove-SPFeatureFromContentDB -ContentDB "MOSS_Global_PAW2_Content" -FeatureId "367b94a9-4a15-42ba-b4a2-32420363e018"
Remove-SPFeatureFromContentDB -ContentDB "WSS_Content_IT_CPS_URSM" -FeatureId "367b94a9-4a15-42ba-b4a2-32420363e018"
You will see the below type of errors in CA monitoring
MissingFeature....
Solution
Run the below cmd in powershell on the sharepoint server
function Remove-SPFeatureFromContentDB($ContentDb, $FeatureId, [switch]$ReportOnly)
{
$db = Get-SPDatabase | where { $_.Name -eq $ContentDb }
[bool]$report = $false
if ($ReportOnly) { $report = $true }
$db.Sites | ForEach-Object {
Remove-SPFeature -obj $_ -objName "site collection" -featId $FeatureId -report $report
$_ | Get-SPWeb -Limit all | ForEach-Object {
Remove-SPFeature -obj $_ -objName "site" -featId $FeatureId -report $report
}
}
}
function Remove-SPFeature($obj, $objName, $featId, [bool]$report)
{
$feature = $obj.Features[$featId]
if ($feature -ne $null) {
if ($report) {
write-host "Feature found in" $objName ":" $obj.Url -foregroundcolor Red
}
else
{
try {
$obj.Features.Remove($feature.DefinitionId, $true)
write-host "Feature successfully removed from" $objName ":" $obj.Url -foregroundcolor Red
}
catch {
write-host "There has been an error trying to remove the feature:" $_
}
}
}
else {
#write-host "Feature ID specified does not exist in" $objName ":" $obj.Url
}
}
Remove-SPFeatureFromContentDB -ContentDB "MOSS_Global_PAW2_Content" -FeatureId "367b94a9-4a15-42ba-b4a2-32420363e018"
Remove-SPFeatureFromContentDB -ContentDB "WSS_Content_IT_CPS_URSM" -FeatureId "367b94a9-4a15-42ba-b4a2-32420363e018"
No comments:
Post a Comment