MissingSiteDefinition on content database migration

This error is usually related to a missing site template that is being used on the SharePoint 2010 farm but is not supported on the target farm 2013 or other.

We first need to get the template name based of the ID indicated in the message in this case ID = [75811]. Second step identifying the site using this template, below are the two scripts

The error message on the log after running test-spcontentdatabase


Category        : MissingSiteDefinition 
Error           : True 
UpgradeBlocking : False 

Message         : 1 Sites in database [WSS_Content_xxxx] have reference(s) to a missing site definition, Id = [75811], Lcid = [1033], compatibility level = [14].  
Remedy          : The site definition with Id 75811 is referenced in the database [WSS_Content_XXXXX], but is not installed on the current farm for sites with compatibility level 14. The  
missing site definition may cause upgrade to fail. Please install any solution which contains the site definition and restart upgrade if necessary. 
Locations       : 

 

List of all subsite under the site collection and their templateID

clear
Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue
function GetAllWebs($url){
 try{
 $w = Get-SPWeb $url -Limit ALL;
 Write-Host ([String]::Format("Procesing web {0}",$w.Url)) -foregroundcolor Blue
   if($w.Webs.Count -gt 0){
            foreach($web in $w.Webs){
                $web.Url
                $spweb = get-spweb $web.Url -limit ALL
                   write-host "Site URL: " $site.URL   
                   write-host "Web Template: " $spweb.WebTemplate   
                   write-host "WebTemplateID: " $spweb.WebTemplateID  
                GetAllWebs $web.Url;
            }
        }
    }
    catch
    {
        Write-Host ([String]::Format("Error processing web at $url, with Exception: {0}", $_.Exception.Message)) -foregroundcolor Red
    }   
}
GetAllWebs("http://domain/sitecollectioname/")

List of template ID’s and their names

$web = Get-SPweb http://your application domain
Write-host “Web Template:” $web.WebTemplate ” | Web Template ID:” $web.WebTemplateId 
$web.Dispose()
# To get a list of all web templates, use the following PowerShell code
function Get-SPWebTemplateWithId { 
     $templates = Get-SPWebTemplate | Sort-Object "Name" 
     $templates | ForEach-Object { 
     $templateValues = @{ 
     "Title" = $_.Title 
     "Name" = $_.Name 
     "ID" = $_.ID 
     "Custom" = $_.Custom 
     "LocaleId" = $_.LocaleId 
      }
    New-Object PSObject -Property $templateValues | Select @("Name","Title","LocaleId","Custom","ID") 
   } 
}

Get-SPWebTemplateWithId | Format-Table

 

Now that you have the information of the site and template, you can either delete, or change site/template from the source if applicable, or move the required files related to the templated to the target destination farm.

 

 

 

Thanks,
Alfi