SharePoint 2013 Change Page Layout using PowerShell

In this post, we will discuss how we can change page layout using PowerShell in SharePoint 2013. We can use PowerShell to change page layout in SharePoint 2013.

You can also read:
Enable Breadcrumb in SharePoint 2013 or Implement Classic Breadcrumb in SharePoint 2013

– Get all workflows from all site collections using server object model in SharePoint 2013

– Custom Ribbon Action and set the Customize Icon to Ribbon button in a SharePoint Hosted App

Below is the PowerShell script to change page layout of default.aspx page in a SharePoint 2013 site or subsite.

Add-PSSnapin “Microsoft.SharePoint.PowerShell”
$spWeb = Get-SPWeb(“https://SiteURL”)

$spFile = $spWeb.GetFile(“https://SiteURL/Pages/default.aspx”)
$spFile.Properties[“PublishingPageLayout”] = “/SiteURL/_catalogs/masterpage/WelcomeLinks.aspx”
$spFile.CheckIn(“Update page layout via PowerShell”,[Microsoft.SharePoint.SPCheckinType]::MajorCheckIn)

Change page layout of all the pages:
If you want to change the page layout of all the pages then you can use the below PowerShell. Refered from here.

$spWeb = Get-SPWeb(“https://SiteURL”)
$pWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($spWeb)
$pSite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($spWeb.Site);

$siteLayouts = $pSite.GetPageLayouts($false)
$myLayout = $siteLayouts[“/_catalogs/masterpage/WelcomeLinks.aspx”]
$query = New-Object Microsoft.SharePoint.SPQuery
$query.ViewAttributes = “Scope=’RecursiveAll'”

$pages = $pWeb.GetPublishingPages($query)

foreach ($page in $pages)
if ($page.ContentType.Name -eq “Folder”)

$page.Layout = $myLayout

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

View all posts by Bijay Kumar →