Get list of pages using a particular page layout using PowerShell in SharePoint 2013

In this post, we will discuss how we can get a list of pages that are using a particular page layout in SharePoint 2013 using PowerShell. Recently while working on a moss 2007 to SharePoint 2013 migration project we got a scenario where we need to find out the page names from a document library which is using a particular page layout.

Below is the PowerShell script.

Add-PSSnapin “Microsoft.SharePoint.PowerShell”

$site = get-SPSite http://win-pfcp2dgt8di/sites/EnjoySharePoint/

$web = $site.RootWeb

$pweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)

$pPages = $pWeb.GetPublishingPages();

$pLayouts =”ErrorLayout.aspx” #$pweb.GetAvailablePageLayouts()

foreach ($pPage in $pPages)

{

if ($pPage.Layout.Name -eq $pLayouts)

{

write-host $pPage.Title

}


}

Hope this will be helpful.


You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →