Check renderings whether caching is enabled

 
While I was working on a Sitecore Audit project, I had to validate all ‘N’ numbers of Sitecore Renderings and prepare a report of each and every rendering which had caching enabled and which were not. Instead of checking it manually just went with the powerful tool SPE.

Below is a script that I used to get the list within minutes 👍

cd master:/sitecore/layout/renderings

Write-Host -Foreground Green "Items which have renderings with caching enabled"
Get-ChildItem -Recurse . | Where-Object { $_.TemplateName -ne "Rendering Folder" -and $_.Cacheable -eq "1" } | Format-Table -Auto -Property Name, ItemPath, ID
 
Write-Host -Foreground Red "Items which have renderings with caching Disabled"
Get-ChildItem -Recurse . | Where-Object { $_.TemplateName -ne "Rendering Folder" -and $_.Cacheable -eq "" } | Format-Table -Auto -Property Name, ItemPath, ID

Hope this helps someone. Feel free to leave a comment to make it better or with any questions!!

Related Posts

Leave a Reply

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