Missing Server Side Dependencies : Resolving MissingWebPart errors in SharePoint Health Analyzer

In certain scenarios Web Part references can get orphaned in the Content DB’s.

The Symptoms

In that same health analyzer report about “Missing server side dependencies” in Central Admin that reports MissingFeatures and MissingAssemblies, you will also sometimes find MissingWebPart errors:


[MissingWebPart] WebPart class [0a61962f-1566-0eb7-5b6f-dede51497848] (class [AEBlogRollupWebpart.AEBlogRollup] from assembly [AEBlogRollupWebpart, Version=, Culture=neutral, PublicKeyToken=8d6c92310d8d661d]) is referenced [3] times in the database [sp_GoContent1], but is not installed on the current farm. Please install any feature/solution which contains this web part. One or more web parts are referenced in the database [sp_GoContent1], but are not installed on the current farm. Please install any feature or solution which contains these web parts.

[MissingWebPart] WebPart class [28c23aec-2537-68b3-43b6-845b13cea19f] is referenced [3] times in the database [sp_GoContent4], but is not installed on the current farm. Please install any feature/solution which contains this web part. One or more web parts are referenced in the database [sp_GoContent4], but are not installed on the current farm. Please install any feature or solution which contains these web parts.
[MissingWebPart] WebPart class [28c23aec-2537-68b3-43b6-845b13cea19f] is referenced [2] times in the database [sp_AdminContentDB], but is not installed on the current farm. Please install any feature/solution which contains this web part. One or more web parts are referenced in the database [sp_AdminContentDB], but are not installed on the current farm. Please install any feature or solution which contains these web parts.

The Cause

These events are logged because the migrated SharePoint 2010 Sites contains some references to custom WebPart files and the linked feature/solution are not installed in the Farm.

The Fix

How does one clean this crap up? Easy, dress up a kid in this ridiculous outfit and parachute them into your SharePoint portal:

The easy solution is obviously to have the baby mop install the features/solution related to those webpart , but if you are in the same situation as us, you don’t really need the webpart anymore and you just want the database to be clean and get rid of these events.
To safely remove the webparts and references, we need to be able to identify their specific location on the Farm.

1. Create the following script as a .ps1 PowerShell (text) file:

param (
    [string]$DBserver = $(throw "Missing server name (please use -dbserver [dbserver])"),
    [string]$path = $(throw "Missing input file (please use -path [pathfile.txt])")

#Set Variables
$input = @(Get-Content $path)

#Addin SharePoint2010 PowerShell Snapin
Add-PSSnapin -Name Microsoft.SharePoint.PowerShell

#Declare Log File
Function StartTracing
    $LogTime = Get-Date -Format yyyy-MM-dd_h-mm
    $script:LogFile = "MissingWebPartOutput-$LogTime.csv"
    Start-Transcript -Path $LogFile -Force

#Declare SQL Query function
function Run-SQLQuery ($SqlServer, $SqlDatabase, $SqlQuery)
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server =" + $SqlServer + "; Database =" + $SqlDatabase + "; Integrated Security = True"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SqlQuery
$SqlCmd.Connection = $SqlConnection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet

function GetWebPartDetails ($wpid, $DBname)
    #Define SQL Query and set in Variable
    $Query =  "SELECT * from AllDocs inner join AllWebParts on AllDocs.Id = AllWebParts.tp_PageUrlID where AllWebParts.tp_WebPartTypeID = '"+$wpid+"'"

    #Runing SQL Query to get information about Assembly (looking in EventReceiver Table) and store it in a Table
    $QueryReturn = @(Run-SQLQuery -SqlServer $DBserver -SqlDatabase $DBname -SqlQuery $Query | select Id, SiteId, DirName, LeafName, WebId, ListId, tp_ZoneID, tp_DisplayName)

    #Actions for each element in the table returned
        foreach ($event in $QueryReturn)
            if ($event.id -ne $null)
                #Get Site URL
                $site = Get-SPSite -Limit all | where {$_.Id -eq $event.SiteId}

                #Log information to Host
                Write-Host $wpid -nonewline -foregroundcolor yellow
                write-host ";" -nonewline
                write-host $site.Url -nonewline -foregroundcolor green
                write-host "/" -nonewline -foregroundcolor green
                write-host $event.LeafName -foregroundcolor green -nonewline
                write-host ";" -nonewline
                write-host $site.Url -nonewline -foregroundcolor gray
                write-host "/" -nonewline -foregroundcolor gray
                write-host $event.DirName -foregroundcolor gray -nonewline
                write-host "/" -nonewline -foregroundcolor gray
                write-host $event.LeafName -foregroundcolor gray -nonewline
                write-host "?contents=1" -foregroundcolor gray -nonewline
                write-host ";" -nonewline
                write-host $event.tp_ZoneID -foregroundcolor cyan

#Start Logging

#Log the CVS Column Title Line
write-host "WebPartID;PageUrl;MaintenanceUrl;WpZoneID" -foregroundcolor Red

foreach ($event in $input)
    $wpid = $event.split(";")[0]
    $DBname = $event.split(";")[1]
    GetWebPartDetails $wpid $dbname

#Stop Logging

2. Paste the above code in a PowerShellScript file, like [MissingWebPartDetails.ps1] and copy it on your local SharePoint Server Drive.
Launch the script from a Windows Powershell Cmd Prompt using the following parametters:

.MissingWebPartDetails.ps1 -DBserver <SQLServerName> -path <fullpathmissingwebparts.txt>

[pathmissingwebparts.txt] is a input file you need to create based on the [MissingWebPart] errors that you get on the SharePoint Health Analyzer
The input.txt file should be formated like this (WebPartId;ContentDatabase), example:

150b4681-ae25-d7be-bc71-1410062c7315;sp_GoContent1 60085034-7d97-27c7-5823-2f941e6be1de;sp_GoContent1 7a95935f-d524-5992-f505-809725b6a9e2;sp_GoContent1

After execution, the script generates a CSV output file in the same folder with details about the webpart location (PageUrl / MaintenanceUrl / Webpart Zone ID).
In our case, the outputs looked something like this:

Transcript started output file is MissingWebPartOutput-2013-03-19_9-17.csv
Windows PowerShell transcript end
End time: 20130319091716

Looking at the URL’s in here, we can see that the offending Web Parts are on the page (or, in our case, old document versions of the pages) https://MySharepoint.com/default.aspx and the second web part, a little trickier but clear if you think about it a bit, is located on the Central Administration web app: /NintexWorkflowReportPages/home.aspx. For page #1, going into the Pages library in SharePoint and deleting (after checking with your team of course) the old versions of the page is the first step.

For page #2, going to the offending page in Central Admin and deleting the broken web parts visible on the live page does the trick. But wait, there’s more! We need to also clear ALL recycle bins in SharePoint, at all levels. This calls for the secret weapon:
For each web application in question, modify the following PowerShell and execute:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$WebApp=get-spwebapplication "https://MySharepoint.com"
    foreach ($SPSite in $webApp.Sites)
     #get the collection of webs
      foreach($SPWeb in $SPSite.AllWebs)
             #Empty the 1st Stage Recycle bin items PERMENANTLY
             #Send the 1st Stage Recycle bin items to 2nd Stage
              write-host "End-User Recycle Bin Items Deleted for:"
              write-host $SPWeb.title ":" $SPWeb.URL "`n"
             #Empty SharePoint site collection recycle bin (Second Stage Recycle bin) or Admin Recycle bin
  write-host "Administrator Recycle bin Items Deleted for:" $SPSite.RootWeb.title "`n"

After all this is done, you should now be able to go back to the Health Analyzer and click Re-analyze, and the errors should go away. Great job, baby mops!

Thanks to Etienne for the main script – hopefully I have helped someone out by rejigging it with all the additional followup bits required.

Note: To remove the [MissingFeature] Database errors, check out this BLOG post.

To remove the [MissingWebPart] WebPart class errors, check out this BLOG post.

health analyzer, missing server side dependencies, missing web part, missingwebpart

Comments (20)

  • How should I interpret these results when I run the script, please?
    .missingwebpart.ps1 -dbserver XXXXX .missingwebparts.txt
    Transcript started, output file is MissingWebPartOutput-2014-01-15_12-21.csv
    Transcript stopped, output file is C:UsersmcoteMissingWebPartOutput-2014-01-15_12-21.csv

  • Great One,, I was trying it with SP2013 and SQL2012 but it throws an error:
    Transcript started, output file is MissingWebPartOutput-2014-03-03_4-01.csv
    Exception calling “Fill” with “1” argument(s): “Invalid object name ‘AllDocs’.”
    At C:scriptsMissingWebPartDetails.ps1:62 char:1
    + $SqlAdapter.Fill($DataSet)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SqlException

  • Hello
    I have the same error on my server :
    [MissingWebPart] La classe du composant WebPart [10cdc2ca-e97b-04b0-ed4c-20255762af42] (classe [WP_PresencesUploadImages.VisualWebPart1.VisualWebPart1] de l’assembly [WP_PresencesUploadImages, Version=, Culture=neutral, PublicKeyToken=d3c716fc9dc5714b]) est référencée [1] fois dans la base de données [WSS_Content_BDC_PROD], mais elle n’est pas installée sur la batterie de serveurs actuelle. Installez la fonctionnalité/solution contenant ce composant WebPart. Des composants Web sont référencés dans la base de données [WSS_Content_BDC_PROD], mais ils ne sont pas installés sur la batterie de serveurs actuelle. Installez une fonctionnalité ou une solution contenant ces composants WebPart.

    I ran your batch with the following text file :

    And the result was :
    Début de la transcription Windows PowerShell
    Heure de début : 20140312160751
    Nom d’utilisateur : xxxxxxxxxx
    Transcription démarrée, le fichier de sortie est MissingWebPartOutput-2014-03-1
    Fin de la transcription Windows PowerShell
    Heure de fin : 20140312160751

    What’s wrong ?
    Thank’s for your help.

  • Hi
    Yes, I put the content in my previous post : there is nothing.
    I don’t have any WebPArtId, PageUrl, MaintenanceUrl or WpZoneID.
    I only have the titles. 🙁

      • no problem, I didn’t realized there were french words in the file. 🙂
        I ran the following command :
        Test-SPContentDatabase -name WSS_Content_BDC_Prod -webapplication http://webapp

        and I get the same message MissingWebPart, as in the central administration.

        then I ran the stsadm command and searched the WebPart Id [10cdc2ca-e97b-04b0-ed4c-20255762af42]. But I didn’t find it !!!!! 🙁

        So I don’t really understand what happen : there is a missing webpart but this webpart is nowhere. 🙁

        • Did you try clearing all Recycle bins with the PowerShell at the end of this post? If not, the error may not disappear from the Health Analyzer.

          Also, if you remove an ErrorWebPart from a publishing page with versioning switched on, you may have to delete all earlier versions of the page before the error disappears from the SharePoint Health Analyzer or Test-SPContentDatabase report. This is because the web part will still be referenced from these versions, even though you removed it from the currently published page.

  • Hi Keith
    I ran the powershell for the recycle bins and I still have the error.
    I don’t think there was versioning on the page, but if it was the case, how can I do ?
    thanks for your help

    • You could audit versioning with a tool like http://versioningmanager.codeplex.com/.

      If possible, you could re-install the missing web part and then uninstall it cleanly.

      In your case the next step I would however take is making sure your farm is patched up to current Service Pack/Cumulative Update levels, and then of course run a PS Config. This may eliminate the apparent orphaned web part record you are encountering.

      Finally, if that doesn’t work, then you might want to live with the fact that all this is about is one row in a SQL database, that the SharePoint Health Reporting is indicating as in issue. You could either suppress the missing web part warning in the Health Reporting (not really what I would do), or, just note this particular missing web part and consider it a “false positive” for the future.

  • Hello,
    Finally I found the missing web part sources and re-installed it.
    But to be sure, can you tell me how I should proceed to uninstall it cleanly please ?
    Actually I just used the functionality called “retract” in VS but I’m not sure it is the good way to proceed… 🙁
    Thanks you for your help.

  • Hi Keith
    Sorry for the late answer but I had some urgent problems to solve.
    It’s ok now the feature has been removed and there is no more message.
    thanks a lot for your help and time.

  • Hi Keith,
    Thanks you for the post, I’ve applied the same steps as above and I’ve found all of errors for OOTB web parts like SiteFeedWebPart and GettingStartedWebPart.
    I’ve SharePoint 2013 with the latest good SP1 installed on it.

    Please let me know your thoughts.


    • Hey Osama,
      You could try running the Products Configuration Wizard and making sure that runs through solid. Failing that, all those OOTB web parts are originally bundled as regular SharePoint features. It should be just a matter of figuring out their feature ID, and re-activating those features with PowerShell. You could ID their feature ID’s by searching around in the SharePoint hive for their feature manifest XML.

  • Hi Keith,
    Thanks for your reply, i found the issue on be because I’ve stopped the SharePoint foundation web application service on the application server, hence the health analyzer roles run on this server and get me this error, to solve this either to stop running the timer service on the app server or to enable SharePoint foundation web application service again on that server.

    • Hey Gaurav, cool- looks like it would be a time saver. Why not post it as a project on Codeplex.com? Unfortunately I and many others would not be able to run an independently developed tool without being able to review the source code. 🙂

      If you put it up on Codeplex maybe we could expand it to cover more than just the Missing Web Part errors but also deal with the rest of those types of “Missing *..” Health Analyzer errors.. just a thought.

Leave a Reply

Your email address will not be published. Required fields are marked *