How to Safely Remove Orphaned Features from a SharePoint 2019 Site
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.

- 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 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.
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.
Log into one of your SharePoint farm servers as an administrator and launch the SharePoint Management Shell with elevated privileges.
Run the command 'Test-SPContentDatabase -Name [YourDatabaseName] -WebApplication [YourURL]' to scan the database. Note the missing feature IDs listed in the output.
Use the command 'Remove-SPFeatureFromContentDB -FeatureId [MissingFeatureID] -Database [YourDatabaseName] -ReportOnly' to preview the cleanup and ensure it targets the correct references.
Run the same command without the '-ReportOnly' flag to permanently and safely clear the orphaned feature references from the content database.
Use the SharePoint Feature Administration and Cleanup Tool
Utilize a trusted graphical tool to visually scan your farm and remove faulty features.
Resolve Missing Features in Deleted Sites
Handle orphaned features that are locked inside sites or webs currently sitting in the recycle bin.
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. Visit the WPS Office website: Go to the official WPS Office website to find the free installer.
- 2. Download the software: Click the 'Free Download' button to get the latest version for your operating system.
- 3. Install and launch: Run the installer, follow the simple on-screen instructions, and launch WPS Office to start working on your documents immediately.

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.




