Home Gitesh Portfolio Blog About Me Gallery Contact

Sitecore: Powershell query to get all items with specific rendering component

With this powershell command you will be to get all items with specific rendering component.


 

 ###Get item name & template for all the items that have a rendering component Breadcrumb(xsltRendering)###
 $id=show-input "Please enter site item id"
 $ascxSublayoutId = "{1A748228-5569-417C-94B6-3AEEA67633A1}";
 $xsltRenderingId = "{D4D5154C-3FDD-403B-A40F-66EE4A8078FE}"
    
$homeDescendantsItem = Get-ChildItem -path "master:" -Id $id -Language "*" -recurse 

 foreach($item in $homeDescendantsItem)
   {
   $renderingDesktop=Get-Rendering -Item $item -Device (Get-LayoutDevice "Default") | Where-Object {$_.ItemID  -match $xsltRenderingId}
   if($renderingDesktop)
	  {
		   write-host $item.Name "," $item.TemplateName "," $item.ContentPath
	  }
   }

Posted: 17/06/2022 1:53:18 p.m. by Gitesh Shah | with 0 comments