This is a PowerShell snippet that lists all non published pages.
param($web_app_url=$(read-host "Please provide web app url of the list to be delete (EG:'http://SSRAP1'):"))
function LoadSharePointPowerShellEnviroment
{
write-host "Setting up Powershell enviroment for Sharepoint" -foregroundcolor Blue
Add-PSSnapin "Microsoft.Sharepoint.PowerShell" -ErrorAction SilentlyContinue
Write-host "Sharepoint PowerShell Snapin loaded." -foregroundcolor Green
}
function NonPublishedPagesReport($nodeWeb2)
{
$pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($nodeWeb2)
$pubPages = $PubWeb.GetPublishingPages()
foreach($pp in $pubPages)
{
if ($pp.ListItem.File.level -ne "Published")
{
$data = @{"url" = $pubWeb.url.ToString() + "/pages/"
"name" = $pp.name.ToString()
"Status" = $pp.ListItem.File.level.ToString()
"user" = $pp.ListItem.File.CheckedOutByUser.LoginName
}
New-Object PSObject -Property $data
}
}
}
function RecurseNav([Microsoft.SharePoint.SPWeb]$nodeWeb)
{
$subWebs = $nodeWeb.GetSubwebsForCurrentUser()
NonPublishedPagesReport($nodeWeb)
foreach ($nextweb in $subWebs)
{
RecurseNav($nextWeb)
}
}
try
{
if($web_app_url -eq $null -or $web_app_url -eq '')
{
throw "You must specify your server name. Value provided was null/empty."
}
$web = Get-SPWeb $web_app_url
RecurseNav($web) | Out-GridView
}
catch [Exception]
{
Write-Host -ForegroundColor Red "Error: $_"
}