SharePoint 2013: How to get the available page layouts of a web
Get the available page layouts of a web in SharePoint 2013 via PowerShell
In my work as a consultant I sometimes need to analyse how a current SharePoint 2013 farm looks like. Of course you have great tools to help you with this like SPDOCKit. But sometimes I need more details of a farm. In this case I needed information on what kind of page layouts where used on a web.
The solution is a PowerShell script that uses GetAvailablePageLayouts method to get the available page layouts of a web in a SharePoint 2013 farm. It also uses a definition of a parameter to get a value of a web. A nice description of this technique can be found in an article of Don Jones in Technet Magazine – Windows PowerShell: Defining Parameters.
To complete this how-to, you must have the following prerequisites must be met:
– A domain account that can log on to one of the SharePoint 2013 servers
– A domain account that has privileges to manage SharePoint 2013 via PowerShell (SPShellAdmin role)
1. Run the Powershell script .\get_pagelayouts.ps1 with your desired weburl, for instance .\get_pagelayouts.ps1 http://weburl
$spweb = Get-SPWeb -Identity $weburl
$pubweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($spweb)
$pagelayouts = $pubweb.GetAvailablePageLayouts() | Select Title,Name
SharePoint 2013, SharePoint 2010
23-01-2015 – 1.0