0

How to get a list of all pages in the SitePages Library and their type using PowerShell?

I have created the pages, some are wiki pages and webpart pages.

1

Use the following Script:

$spWeb = Get-SPWeb SiteUrl
$listName = "Site Pages"
 $list = $spWeb.Lists |? {$_.Title -eq $listName}
  foreach ($item in $list.Items) 
  {
  Write-Host $item["ContentType"]
  }
$spWeb.Dispose()
0

The following script prints pages information from Site Pages library:

Get-SPWeb http://contoso.intranet.com/ |
Select -ExpandProperty Lists |
Where { $_.Title -eq "Site Pages" } |
Select -ExpandProperty Items |
Select Name, url, {$_["ContentType"]} 

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.