Sitecore PowerShell

List all active items


cd master:/sitecore/content/Home/Course-Listing/Tutorials

Get-ChildItem -Language "en" -Recurse `
| where-object { $_.TemplateName -match "Tutorial" } `
| where-object { $_."End Date" -gt [datetime]::Now } `
| format-table Name, "Tutorial Id", "Description"

List all items with non-empty comment


cd master:/sitecore/content/Home/Course-Listing/Tutorials

Get-ChildItem -Language "en" -Recurse `
| where-object { $_."Comment" -ne $null -and $_."Comment" -ne ""} `
| format-table Name, "Tutorial Id", "Description"


cd master:/sitecore/content/Home/Course-Listing

Get-ChildItem -Path ./Tutorials -Language "en" -Recurse `
| where-object { $_."Comment" -ne $null -and $_."Comment" -ne ""} `
| format-table Name, "Tutorial Id", "Description"

List all items that were last modified by the Anonymous user less than 100 days


$Events = "\\Content\Home\Course-Listing\Tutorials" 

Get-ChildItem web:$Events -Language "en" -Recurse `
  | where-object { $_.__Updated -lt [datetime]::Now.AddDays(-100) } `
  | where-object { $_."__Updated By" -eq "sitecore\Anonymous" } `
  | format-table -property "__Updated By", {$_.Paths.Path}, {$_.__Updated}


$Events = "\\Content\Home\Course-Listing\Tutorials" 

Get-ChildItem web:$Events -Language "en" -Recurse `
| where-object { $_.__Updated -lt [datetime]::Now.AddDays(-100) } `
| where-object { $_."__Updated By" -eq "sitecore\Anonymous" } `
| Show-ListView -Property DisplayName,Name,version,id, {$_.__Updated}

Export all active items to a CSV file


cd master:/sitecore/content/Home/Facets

Get-ChildItem -Recurse `
 | where-object { $_."Active Flag" -eq "Y" } `
 | Select-Object -property @{Name="Code";Expression={$_.Name}}, "Taxonomy Name" `
 | Export-Csv -path c:\tmp\Facets.csv -NoTypeInformation