How can I use PowerShell to check if the latest version of a publishing page has been published?

1 Answer 1


Please run the following PowerShell script:

if ((gsnp Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue) -eq $null){
    asnp Microsoft.SharePoint.Powershell -ErrorAction Stop

$site = Get-SPSite http://intranet
$log = "C:\temp\PageLayouts.csv"

##Check if log file exists and clear its content

if ((Test-Path -Path $log -ea SilentlyContinue) -ne $null){
    clc $log
    ac $log "Page URL, Page Title, Page Layout URL, Page Layout Title"

##loop through all webs in the site collection

$site | Get-SPWeb -Limit All | %{
    $web = $_

    ## Get the page library and items

    $pl = $web.Lists["Pages"]
    $pages = $pl.Items
    foreach ($page in $pages){

        ## add content to the log file

        ac $log "$($web.url)/$($page.Url), $($page.Title), $($page.Properties["PublishingPageLayout"])"


More information, please refer to this article.

  • This shows the page layout but not if the latest version is published or not
    – jlai
    Mar 30, 2021 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.