Skip to content

Instantly share code, notes, and snippets.

@michaellwest
Created November 24, 2015 14:30
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 michaellwest/b9a3ded4a17c1a6d77bb to your computer and use it in GitHub Desktop.
Save michaellwest/b9a3ded4a17c1a6d77bb to your computer and use it in GitHub Desktop.
Generates a report with all Sitecore content items, excluding specific template ids.
<#
.SYNOPSIS
Queries all pages on the site, excluding non-content items.
#>
# List of template ids to exclude from the count.
$templateIds = @(
"{29FD19B5-6F81-4829-B725-9C4279DA13CE}",
"{C3C9ED41-B476-49A9-B50C-FF8901665EA0}",
"{5A905A62-4898-44CE-96BA-EB3432BAAD91}",
"{C48E3C71-1DD0-4658-9C79-1A593D6CA2FE}",
"{9FEF9950-3A87-4CD6-BFE6-4995EEDE5C5A}",
"{5CE97AE2-C623-4690-80FA-1765CF4F5EC3}",
"{DF7A06FC-80AC-4261-AA1C-0F476E1DC7DC}",
"{A4119A59-7929-48D7-8A79-66315411AA7F}",
"{272C7024-6703-41FA-A432-3605F970F546}",
"{45E0204D-A5FF-4E3D-BA5F-013D8F876E47}",
"{ECA52758-43B8-4F0E-BE62-00E1BC49677D}"
)
@(Get-Item -Path master:\content\home) + @(Get-ChildItem -Path master:\content\home -Recurse) |
Where-Object { $templateIds -notcontains $_.TemplateId } | Sort-Object -Property Name |
Select-Object -Property Name, ItemPath, TemplateId, Id | Export-Csv -Path "C:\Inetpub\wwwroot\[INSTANCE_NAME]\Website\report-pages-20150824.csv"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment