SharePoint 2013 Missing Server Dependencies

The Health Analyzer in Central Administration reports “Missing server dependencies”.

SharePoint Health Analyzer has detected some critical issues

SharePoint Health Analyzer has detected some critical issues

Health Analyzer reports Missing server dependencies

Health Analyzer reports “Missing server dependencies”

I had a lot of those after an upgrade from 2010 to 2013, all caused by features which had been in the 2010 system but were not wanted in the 2013 system. Some were third party web parts that had been installed and never used, there was another third party solution which was going to cost too much to upgrade and had never really met the business requirements in any case, and some free workflow extension packs which weren’t compatible with 2013. All of these had been removed from the 2010 environment, but the Health Analyzer still found traces of them in the 2013 system.

Searching for a solution brought me to the Get-SPScripts website and three pieces of PowerShell for dealing with three specific missing server dependencies errors that the Health Analyzer reports:

Although these scripts were written for SharePoint 2010, they work fine in 2013.

As the articles above indicate, you then have to so some detective work to find out exactly what is missing and how to get rid of it, and then remove the offending object through the UI or with some PowerShell.

For a “MissingWebPart”, the error message starts with “[MissingWebPart] WebPart class [cb12c1aa-b54f-801d-3dde-2843d55fb558]” and continues “is referenced [n] times in the database [SharePoint_Content_DB_Name]”. You need to copy the class GUID and the database name, plus the database server name, into the SQL query, like this:

Run-SQLQuery -SqlServer "SQL_Server_Name" -SqlDatabase "SharePoint_Content_DB_Name"
 -SqlQuery "SELECT * from AllDocs inner join AllWebParts on AllDocs.Id
 = AllWebParts.tp_PageUrlID where AllWebParts.tp_WebPartTypeID = 'class_GUID_from_error_message'"
 | select Id, SiteId, DirName, LeafName, WebId, ListId, tp_ZoneID, tp_DisplayName
 | Format-List

My “MissingWebPart” messages all pointed to left-overs from third-party or custom developed features that were no longer required, and they were all in the site colelction Web Part Galleries. For some of these I could simply go to a site collection’s Web Part Gallery – https://<site-collection-url>/_catalogs/wp – and delete the file, and then go to the Site Collection Recycle Bin and permanently delete it. But some of the missing web part errors pointed to features in the My Sites web application, and I was not going to manually go through a thousand My Sites and do that. So I turned to a PowerShell function, in this case to remove “ReportViewer” web parts:

#Function that deletes Web Parts from the Web Parts catalogue 
function RemoveWebPartsFromCatalogue 
{ 
    param ($sSiteCollection)   
    try 
    {     
        $spSiteCollection = Get-SPWeb -Identity $sSiteCollection         
        $wpCatlog =[Microsoft.SharePoint.SPListTemplateType]::WebPartCatalog 
        $spList = $spSiteCollection.GetCatalog([Microsoft.SharePoint.SPListTemplateType]::WebPartCatalog)         
        $wpID = New-Object System.Collections.ObjectModel.Collection[System.Int32] 
         
        #Getting Web Parts to be deleted 
        foreach ($spItem in $spList.Items) 
        {             
            if($spItem.DisplayName.Contains("ReportViewer")) 
            {    
                #$spItem.DisplayName 
                $wpID.Add($spItem.ID)  
            } 
        } 
         
        #Deleting the Web Parts 
        foreach($wp in $wpID) 
        {               
            $wpItem = $spList.GetItemById($wp) 
            write-Host -f magenta "Deleting Web Part with ID $wpID from" $sSiteCollection
            $wpItem.Delete() 
        } 
        $spList.Update() 
        $spSiteCollection.Dispose()     
    } 
    catch [System.Exception] 
    { 
        write-host -f red $_.Exception.ToString() 
    } 
} 

To deal with the My Sites, I could then use a PowerShell loop to go through each My Site collection in the My Sites web application:

$webApp = Get-SPWebApplication &lt;my-site-host-site-collection-url&gt;

foreach($site in $webApp.Sites)
{
 RemoveWebPartsFromCatalogue -sSiteCollection $site.Url
 $site.Dispose()
}

The final step was to go back to Central Administration to confirm Health Analyzer no longer reported that missing server dependency error. If you click on the individual Health Analyzer error message you can choose to Rerun.

Reanalyze Now - Missing server dependencies

Reanalyze Health Analyzer report

Give the command time to run, several minutes, and then check the Health Analyzer again.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.