clear
filter Get-PublishingPages {
$pubweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($_)
$query = new-object Microsoft.SharePoint.SPQuery
$query.ViewAttributes = "Scope='Recursive'"
$pubweb.GetPublishingPages($query)
}
$FilePath="D:\\Pankaj\\PageAndLayouts.csv"
$str = Read-Host "Enter Site URL:"
if($str -eq $null )
{
Write-Host "Enter a valid URL”
return
}
$site = Get-SPSite -Identity $str
if($site -eq $null)
{
Write-Host "Enter a valid URL"
return
}
$allweb = $site.Allwebs
foreach($web in $allweb )
{
Write-Host $web.Title;
$web | Get-PublishingPages | select Uri, Title, @{Name='PageLayout';Expression={$_.Layout.ServerRelativeUrl}}|Export-CSV -Append $FilePath
}
filter Get-PublishingPages {
$pubweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($_)
$query = new-object Microsoft.SharePoint.SPQuery
$query.ViewAttributes = "Scope='Recursive'"
$pubweb.GetPublishingPages($query)
}
$FilePath="D:\\Pankaj\\PageAndLayouts.csv"
$str = Read-Host "Enter Site URL:"
if($str -eq $null )
{
Write-Host "Enter a valid URL”
return
}
$site = Get-SPSite -Identity $str
if($site -eq $null)
{
Write-Host "Enter a valid URL"
return
}
$allweb = $site.Allwebs
foreach($web in $allweb )
{
Write-Host $web.Title;
$web | Get-PublishingPages | select Uri, Title, @{Name='PageLayout';Expression={$_.Layout.ServerRelativeUrl}}|Export-CSV -Append $FilePath
}