PowerShell – Get all SharePoint pages in a site collection

If you need to get all pages (.aspx) within a site collection, I have created a small script. The script enumerates through a site collection (sub-sites included) and retrieves all .aspx pages.
Before executing the script there are some requirements:

  • You need to be administrator on the site collection.
  • Install the PnP PowerShell module for SharePoint (the script was tested with SharePoint Online).

There are 3 variables you need to modify on line 32 (site collection URL), 33 (SharePoint root URL), 34 (username) and 35 (password).
The script will generate a report (when finished) on the desktop of the user running the script containing the URL, author and last modified date of the page.

Experienced advanced operations engineer with a demonstrated history of working in the information technology and services industry. Skilled in Windows Server, Azure, Ethical Hacking, Office 365, Exchange, Jenkins, SCCM, Octopus Deploy and PowerShell to name a few. Strong engineering professional with a big passion for knowledge.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.