Skip to content

Instantly share code, notes, and snippets.

@Wesley-Lomax
Created March 23, 2018 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wesley-Lomax/8f29e15119d87a00881e30b915f6dfa9 to your computer and use it in GitHub Desktop.
Save Wesley-Lomax/8f29e15119d87a00881e30b915f6dfa9 to your computer and use it in GitHub Desktop.
Get Count of all Sitecore Items in list of templates in content tree
<#
SYNOPSIS
Does a simple count of all items in the specified templates
INSTRUCTIONS
After Get-Item -Path, type the path of the parent you want to start with.
EX: master:\sitecore\content\sites\example
Put the same path after Get-ChildItem, which will crawl through and find all child pages.
It'll display the number
#>
$templateIds = @(
"{051B751D-F6CE-400E-BE22-F5CE61DA3C35}", <# Specialist product landing page #>
"{5451754D-14EC-4E86-BDEB-35D2978B8AB8}", <# Specialist product listing page #>
"{DB5B73EF-F140-4F25-B14A-278AF020C5B6}", <# Transactional landing page #>
"{41AAB73D-C936-4658-A555-4D3944D90E72}", <# Transactional landing page (201605110) #>
"{3432672A-D6BE-4B08-A0DB-BBC5C726468D}", <# Category Landing Page (20160511) #>
"{2743C212-DD83-4B9E-ABB8-39D744D6738D}", <# Category Landing Page x 2 #>
"{79CC8C84-ABC0-458E-8A19-DAD9EE32E80E}", <# Category Landing Page x 3 #>
"{B6E873AB-9C34-4575-A2B9-96E2F7BE1703}", <# Category Landing Page x 4 #>
"{289A10FD-71C8-457B-8735-1A28D0BEEE89}", <# Landing page #>
"{D6A18312-67CB-4F26-98DE-B714B7E69594}", <# Rich landing page #>
"{7AF33A1B-5641-4A8D-9E4E-BC36A15A64EB}" <# Alternate landing page #>
)
@(Get-Item -Path master:\content\home) + @(Get-ChildItem -Path master:\content\home -Recurse) |
Where-Object { $templateIds -eq $_.TemplateId } |
Measure-Object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment