Powershell script which can generate all page urls along with layout name for site collection.
$objSite = Get - SPSite "site collection url"
[Microsoft.Sharepoint.Publishing.PublishingSite] $publishingSite = New - Object Microsoft.SharePoint.Publishing.PublishingSite($objSite)
#Gets all Page Layouts
for the current Site Collection, no need to iterate all subwebs
$pageLayouts = $publishingSite.GetPageLayouts($false)
#I can make use of Export - CSV to generate a.csv file
for reporting purposes.That works like a charm.#But Powershell also provides you with a lovely Grid View interface,
try doing something like this:
$pageLayouts | Export - CSV D: \Ramlogs\layoutName.csv
##Of course,
I will wrap the above script in a foreach block to iterate through all web applications and site collections in the SP 2010 Farm.
##Iterate through all the Publishing Page Layouts
foreach($layout in $pageLayouts) {##Get Page Layout File object[Microsoft.SharePoint.SPFile] $file = $publishingSite.RootWeb.GetFile($layout.ServerRelativeUrl);
$name = $layout.Name
#Backward links contain the URLs of all files that link to the current file from the current site collection and its#sites / subsites.#Pages that link to the current file from another Web site or site collection are not included in the backward#link information.
#returns $true,
if SPFile.BackwardLinks.Count is greater than 0 $IsPageLayoutInUse = ($file - ne $null - and $file.BackwardLinks - ne $null - and $file.BackwardLinks.Count - gt 0) if ($IsPageLayoutInUse) {
$array = $file.BackwardLinks | sort - unique;
$array | Export - CSV D: \Ramlogs\$name.csv
}
}