SharePoint Upgrade: Simple OOTB Inventory Methods Useful for Resolving Missing Dependencies

The following are simple OOTB inventory methods that I use when resolving missing dependencies listed in the report generated by Test-SPContentDatabase. These reporting methods work for SharePoint 2010, 2013 and 2016 on-premises. No need for third-party tools, which just do the same thing, but insert a layer of abstraction between you and the API. I find it more useful to extract the data through the API directly as this gives me a better sense of and confidence in the data. Since these methods all use the API, you can comfortably use them on production as well as development.

Enumerate All Webs
This report uses STSADM to generate a hierarchical list of webs, event receivers, setup files, features, etc for each site collection hosted in a content database. Using the syntax provided below, the report is saved in XML format, enabling simple, rapid and efficient text-based searches by name, ID, etc. For example, searching on the ID of a missing feature quickly identified all three subsites where that feature had been activated. The report list includes the IDs for these objects (where appropriate) and some key information on the object, such as its name and whether it is missing. This report is only available through STSADM. It also works for SharePoint 2013 and 2016, but only if the "-includewebparts" and "-includecustomlistview" switches are not used.

CD C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\
echo ^<?xml version="1.0" encoding="ISO-8859-1"?^>  > "EnumAllWebs.xml"
stsadm -o enumallwebs -databasename "WSS_Content" -includefeatures -includeeventreceivers -includesetupfiles >> "EnumAllWebs.xml"

Activated Farm Features
This report lists all activated features having Farm-scope. Generated by PowerShell commandlet and formatted as CSV. Includes all feature properties. This report was executed to document the features activated at the farm level after visually inspecting farm features and to discover hidden farm features. Some third party solutions have a farm-scope feature that manages solution licensing.

Get-SPFeature -farm | Export-csv -path "Get-SPFeature.farm.csv"

Activated Web Application Features
This report lists all activated features having web application-scope. Generated by PowerShell commandlet and formatted as CSV. Includes all feature properties. Executed to document activated features at the web application level. Some third party farm solutions have features that are activated at the web-application level. I find it useful to check on this as I can use this to manage which web application the solution is made available to in farms having dedicated and costed customer web applications.

Get-SPFeature -WebApplication "https://www.contoso.com/” | Export-csv -path "Get-SPFeature.WebApp.csv"

Activated Site Collection Features
This report lists all activated features having site collection-scope. Generated by PowerShell commandlet and formatted as CSV. Includes all feature properties.

Get-SPFeature -Site "https://www.contoso.com" | Export-csv -path "Get-SPFeature.Site.csv"

Activated Web Features
This report lists all activated features having web-scope. Generated by PowerShell commandlet and formatted as CSV. Includes all feature properties.

Get-SPSite -Identity "https://www.contoso.com" | Get-SPWeb -Limit ALL |%{ Get-SPFeature -Web $_ } | Export-csv -path "Get-SPFeature.Web.csv"

Installed Farm Solutions
This report lists all solutions added to the farm and installed to farm web applications. Generated by PowerShell commandlet and formatted as CSV. Includes all solution properties. In this upgrade and migration effort, this report was used in conjunction with the site collection and web feature reports, to definitively associate a feature with an unfamiliar solution, such as when investigating features associated with third-party solutions that need to be removed. Sometimes features do not provide immediately clear associations with their solutions, so, they need to be matched through the solution ID. It provides good background on the overall effort, but does not provide information useful directly to the upgrade effort.

Get-SPSolution | Export-csv -path "Get-SPSolution.Farm.csv"

All Webs
This report lists all webs in a site collection. Generated by PowerShell commandlet and formatted as CSV. Includes all web properties. In this migration effort, this report was found useful when needing to quickly determine the number of webs in a site collection and when needing to verify that a particular web had been deleted.

$site = Get-SPSite "https://www.contoso.com";$site.AllWebs | Export-csv -path "AllWebs.csv"

All Lists and Libraries
This report lists all lists and all document libraries in all webs in a site collection, grouped by their parent web. Generated by PowerShell script. As used in this upgrade and migration, this report script is a tweak of the original script developed by SharePointRyan. The modified version provides some additional list/library information, such as number of items. In this upgrade and migration effort, this report was useful in quickly determining which webs contained the Microsoft Project-related lists and document libraries that needed to be deleted. It also provided handy cross-correlation between the missing assembly names found in a Test-SPContentDatabase Upgrade report and the results of a query of the content database's EventReceivers table for those missing assemblies. The query results return HostIDs, which are the IDs of the list or document library that the receiver is attached to. The correlation is like so:
Upgrade report MissingAssembly name <<>> Content Database EventReceivers table query results <<>> All Lists and Libraries Report

function Get-SPSiteInventory {
Param(
[string]$Url,
[string]$path
)
#
# To run it from the prompt, first dot-source it like so:
# ". C:\MyDir\Get-SPSiteInventory.ps1"
# then execute it like any other function.
#
Start-SPAssignment -Global
        $site = Get-SPSite $Url
        $allWebs = $site.allwebs
Add-Content -Path $path -Value "ParentWebUrl, DefaultViewUrl,Title, BaseType, BaseTemplate, Author, Created, LastModifiedDate, ID, EventReceivers, Count"
        foreach ($spweb in $allWebs) {
            $allLists =  $spweb.Lists
            foreach ($splist in $allLists){
                $str = $splist.ParentWebUrl + ", " + $splist.DefaultViewUrl + ", " + $splist.Title + ", " + $splist.BaseType + ", " + $splist.BaseTemplate + ", " + $splist.Author + ", " + $splist.Created + ", " + $splist.LastModifiedDate + ", " + $splist.ID + ", " + $splist.EventReceivers + "," +  $splist.items.count
                Add-Content -Path $path -Value $str
            }
            $spweb.dispose()
        }
        $site.dispose()
Stop-SPAssignment -Global
}

Visual Inspections
This report lists all solutions at the farm and site collection levels; and listings of features and their status at the farm, web application, site collection and web levels; compiled through direct visual inspection of appropriate settings pages. I perform visual inspections at the outset to build a general sense of feature availability and activation status at the farm, web application, site and web levels. I'll also sometimes compile this information in a spreadsheet or screen captures to later compare with the reports generated by PowerShell as a quality assurance check.

Content Database Upgrade Reports
This report lists all blocking and non-blocking problems associated with upgrade of the content database. Problems are categorized by type, including: MissingSiteDefinition, MissingFeature, MissingSetupFile, MissingAssembly and MissingWebPart. Generated by executing Test-SPContentDatabase and by executing Mount-SPContentDatabase. HThese reports are the basis for resolving all missing dependencies.

Test-SPContentDatabase -name "WSS_Content" -webapplication "https://www.contoso.com" | Export-CSV -Path "test-upgrade.YYYYMMDDhhmm.CSV"

Site Collection Upgrade Reports
Listing of problems associated with upgrade of the site collection itself. These reports are generated by: 1) initiating a site collection upgrade health check or 2) launching a site collection upgrade itself. The upgrade report results are summarized on a web page that the administrator is navigated to after the health check or site upgrade is completed, and a more detailed report is written to a separate SiteUpgrade report. These reports are saved to the configured location of your ULS logs.

NOTE: these reports are not generated for 2016 if you perform a standard Mount-SPContentDatabase operation. if you still want these for 2016, you must use the -SkipSiteUpgrade switch when executing the mount commandlet and then execute the usual Upgrade-SPSite commandlet afterwards.

Site Collection Health Check Report
This report is generated through the UI. Navigate to: Site > Site Settings > Site Collection Administration > Site collection health checks. It's presented visually, on the page, so, I copy the listing and insert into a spreadsheet.

Site Collection Upgrade Report
This report is generated when you either initiate the site collection upgrade through the UI or by executing the script below.

Upgrade-SPSite -Identity "http://www.contoso.com" -VersionUpgrade