logo
search
SharePoint Document Issues

How to Safely Remove Orphaned Features from a SharePoint 2019 Site

Huma Ashraf ChHuma Ashraf Ch Sep 29, 2026 869 views

Question details

The user needs a method to safely remove orphaned feature references left behind in a SharePoint 2019 content database after migrating sites or uninstalling WSP solutions.

How to Remove Orphaned Features from a SharePoint 2019 Site
Product
SharePoint 2019
Device & OS
not provided
Scenario
Cleaning up a SharePoint farm environment after a migration or after uninstalling custom WSP solutions that were not properly deactivated.
Observed behavior
Feature references remain stuck in the content database, causing farm health analyzer errors or migration blocks, even though the original feature is no longer installed on the farm.
Before you start

Before beginning the cleanup process, ensure you have a complete backup of your SharePoint environment. Never attempt to directly modify or delete rows in the SharePoint SQL databases, as this is completely unsupported and can permanently corrupt your farm.

Solution 1Recommended

Identify and Remove Features using PowerShell

Use native SharePoint Management Shell cmdlets to safely identify affected databases and remove orphaned features without database modification.

Microsoft provides native PowerShell cmdlets that safely interact with the SharePoint object model to identify missing features and remove their references from the content database.

1
Open SharePoint Management Shell

Log into one of your SharePoint farm servers as an administrator and launch the SharePoint Management Shell with elevated privileges.

2
Identify affected databases

Run the command 'Test-SPContentDatabase -Name [YourDatabaseName] -WebApplication [YourURL]' to scan the database. Note the missing feature IDs listed in the output.

3
Test feature removal

Use the command 'Remove-SPFeatureFromContentDB -FeatureId [MissingFeatureID] -Database [YourDatabaseName] -ReportOnly' to preview the cleanup and ensure it targets the correct references.

4
Execute permanent removal

Run the same command without the '-ReportOnly' flag to permanently and safely clear the orphaned feature references from the content database.

Reinstalling features: If you actually need the feature but it is currently missing, you can reinstall the missing WSP solution and use the 'Install-SPFeature' command instead of removing the references.
Free Microsoft Office alternative

Enhance Your Team's Productivity with WPS Office

While managing complex server environments like SharePoint requires extensive IT administration, your team's daily document creation shouldn't be a hassle. WPS Office offers a highly compatible, lightweight, and user-friendly alternative to Microsoft Office, ensuring seamless collaboration without heavy system overhead.

  1. 1. Visit the WPS Office website: Go to the official WPS Office website to find the free installer.
  2. 2. Download the software: Click the 'Free Download' button to get the latest version for your operating system.
  3. 3. Install and launch: Run the installer, follow the simple on-screen instructions, and launch WPS Office to start working on your documents immediately.
Highly compatible with Microsoft Word, Excel, and PowerPoint file formats.Lightweight application footprint that ensures smooth performance on any device.Familiar tabbed interface requiring zero learning curve for immediate productivity.Built-in advanced PDF editing and format conversion tools.
microsoft office alternative - wps office

Frequently Asked Questions

Why do orphaned features appear in SharePoint content databases?

Orphaned features usually occur when a custom WSP solution is uninstalled from the farm, or a site is migrated, without first deactivating the associated features inside the site collections or webs.

Can I delete the missing feature directly from the SharePoint SQL Server database?

No. Directly modifying or deleting rows in SharePoint SQL databases is completely unsupported by Microsoft. Doing so can cause severe, irreversible farm corruption and void your Microsoft support agreement.

What exactly does the Test-SPContentDatabase command do?

The Test-SPContentDatabase cmdlet scans a specific content database against a web application to verify that all referenced features, site templates, and setup files are properly installed and available in the SharePoint farm.

How do I deal with an orphaned feature if I plan to reinstall the solution later?

If you intend to use the feature again, you do not need to remove the references. Simply deploy and install the missing WSP solution to the farm using the 'Install-SPFeature' command, which will resolve the missing references automatically.