Remove orphaned features from site on the SP2019.

Oleg Tserkovnyuk 586 Reputation points
2021-04-26T13:44:43.593+00:00

Hello,

I found few orphaned features on the site which was migrated from SP2013 to SP2019. Long time ago site was created on the SP2007. Site uses few custom .wsp packages, but all these packages are on the SP2019.
Config wizard crashes on the site's DB:
Feature (Id = [cca78623-ccac-44be-a22a-1585f3954616]) is referenced in database [SP2019_site1], but isn't installed on the current farm. The missing feature might cause upgrade to fail. If necessary, please install any solution that contains the feature and restart upgrade.
Feature (Id = [96c15bfd-86d4-4871-a3bf-b479bf6416d8]) is referenced in database [SP2019_site1], but isn't installed on the current farm. The missing feature might cause upgrade to fail. If necessary, please install any solution that contains the feature and restart upgrade.

Feater admin tool cannot find these features.

PS commands also cannot find them:
$site = get-spsite http://site1.company.com
$site.Features | ft DefinitionID
ForEach ($Web in $Site.AllWebs) {$web.Features | ft DefinitionID}

So far I have found only one solution to access these features. Run SQL command:
SELECT * From AllLists (NOLOCK) WHERE tp_FeatureId = 'cca78623-ccac-44be-a22a-1585f3954616'
SELECT * From AllLists (NOLOCK) WHERE tp_FeatureId = '96c15bfd-86d4-4871-a3bf-b479bf6416d8'

I know that it is possible to delete them using command:
delete AllLists WHERE tp_FeatureId = 'xxxxxx'

But I also know that MS does not support this. What is the right way to delete these features?

SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,878 questions
{count} vote

3 answers

Sort by: Most helpful
  1. Echo Du_MSFT 17,141 Reputation points
    2021-04-27T03:01:01.293+00:00

    Hello @Oleg Tserkovnyuk ,

    According to the error message you gave, it can be concluded that some features are missing in Content database (SP2019_site1).

    It is recommended that you use the SharePoint Feature Administration and Clean Up Tool, which basically allows us to remove any references to features that are not installed in the web site from the server farm, web application, site collection, and subsites.

    You can refer to this post, it may help you to solve problem.

    Thanks,
    Echo Du

    =========================
    Updated Answer =======================
    Hi @Oleg Tserkovnyuk ,

    1.Try to run Test-SPContentDatabase as the following

    $wa = Get-SPWebApplication https://sharepoint.contoso.com"  
    $outputPath = "C:\\tools\files\Output\Test_Wss_Content_MissingAssembly_{0}.txt" -f (Get-Date -Format hhmmss  
    $dbName = "WSS_Content"  
    $slqServer = "SPSQL"  
    Test-SPContentDatabase -Name $dbName -WebApplication $wa -ServerInstance $slqServer -ShowLocation:$true -ExtendedCheck:$false | Out-File $outputPath Write-Host "Test results written to $outputPath"  
    

    2.Then open the file in the specified path, get the feature ID and Site ID in the location row and update the below script with theses entries.

    3.Then run the below script to remove features by ID:

    $featureID = "Feature ID"  
    $siteID = "Site ID"     
    
    #Display site information  
    $site = Get-SPSite $siteID    
    Write-Host "Checking Site:" $site.Url  
    
    #Remove the feature from all subsites  
    ForEach ($web in $Site.AllWebs)  
        {  
            If($web.Features[$featureID])  
                {  
                    Write-Host "`nFound Feature $featureID in web:"$Web.Url"`nRemoving feature"  
                    $web.Features.Remove($featureID, $true)  
                }  
                else  
                {  
                    Write-Host "`nDid not find feature $featureID in web:" $Web.Url  
                }    
        }  
    
    #Remove the feature from the site collection  
    If ($Site.Features[$featureID])  
        {  
            Write-Host "`nFound feature $featureID in site:"$site.Url"`nRemoving Feature"  
            $site.Features.Remove($featureID, $true)  
        }  
        else  
        {  
            Write-Host "Did not find feature $featureID in site:" $site.Url  
        }  
    

    4.Finally, run the below script:

    Remove-SPFeatureFromContentDB -ContentDB "Wss_Content" -FeatureId "xxxx-xxxxx-xxxxx-xxxx" –ReportOnly  
    

    If the above steps failed, so you would install the missing feature manually via Install-SPFeature

    Thanks,
    Echo Du

    ===================

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Oleg Tserkovnyuk 586 Reputation points
    2021-06-17T10:43:42.11+00:00

    Hello,

    Thank you for update.
    Unfortunately scripts from steps 3 and 4 cannot find this feature.
    Script from step one finds it.

    0 comments No comments

  3. Noorul Ahmed 41 Reputation points
    2024-06-09T02:33:33.59+00:00

    Hi There,

    I am facing the similar issue. I am trying to migrate My Sites collection from a SharePoint 2019 environment to a SharePoint Subscription Edition environment using database detach method. When I perform Test-SPContentDatabase in the destination farm, I get the following error.

    Database WSS_Content_MySite has reference(s) to a missing feature: Id = [d2b9ec23-526b-42c5-87b6-852bd83e0364] but isn't installed on current farm

    These missing features are Access and Access 2010 services that are installed on the SharePoint 2019 environment. These services are no longer supported on the SharePoint Subscription environment. @Echo Du_MSFT Could you advise me in such case? There are no custom features installed on the MySiteHost site collections and OneDrive personal site collections hosted on the SP 2019 environment.