Renderings, Pages and Template Reporting with Powershell
Had a need to analyze an existing site to understand what components were used on it, and found a handy stack overflow question and answer and related blog post. While the approach was good, I didn’t have easy access to the file system on the server, to get at the csv it produced, and wanted more details: Controller Actions, Rendering View Paths, Data Source and Details on the Page Templates.
So I extended the sample to include those fields (which generates some errors/warnings when datasources are not guids, but powershell is forgiving and I get back the data I want). I also pipe the results to the “Show-ListView” command which displays the results in a friendly grid, complete with export to Excel, CSV and other formats which can be easily downloaded through the browser.
Here’s the Updated Script for future reference (when I need to run this kind of analysis again):
Couple of tips for customizing and using this script:
Update the $pages declaration to your specific site.
Remove the Recurse if you’re testing adding fields as it could take a while if you have a lot of content on your site.
After dumping the results to CSV (which exports more quickly) or Excel, I then will create a few Pivot Tables to show how many times each component is used, how many pages per template, how many components per page across the site.