How to Add SharePoint Site Pages to an Automated Site Template
Question details
The user needs a way to include preconfigured home pages and populated Site Pages in an automated SharePoint site template.

- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- Automating the creation of new SharePoint sites and attempting to include custom page layouts and content in the deployment templates.
- Observed behavior
- The Get-SPOSiteScriptFromWeb command generates structural scripts for the Site Pages list but fails to capture and reproduce the actual content within those pages.
Ensure you have SharePoint administrator privileges and have installed the latest version of PnP PowerShell before attempting to provision custom site pages.
Use PnP PowerShell to Provision Site Pages
Since native site scripts do not capture page content, PnP PowerShell provides a robust alternative to export and apply complete site page templates.
PnP (Patterns and Practices) PowerShell extends standard SharePoint administration by offering deep provisioning capabilities. It can successfully extract modern site pages, including web parts and content, which native Site Scripts simply omit.
Open PowerShell as an administrator and run 'Install-Module PnP.PowerShell' to ensure you have the latest cmdlets.
Authenticate to your perfectly configured source SharePoint site using 'Connect-PnPOnline -Url <YourSiteURL> -Interactive'.
Run 'Get-PnPSiteTemplate -Out template.xml -IncludeAllClientSidePages' to extract the site structure along with the content of all modern site pages.
Connect to your newly created destination site and run 'Invoke-PnPSiteTemplate -Path template.xml' to populate it with the preconfigured pages.

Utilize Microsoft Graph API for Custom Page Provisioning
For developers building custom automation flows, Microsoft Graph API allows programmatic creation and configuration of SharePoint pages.
Draft Content Seamlessly with WPS Office
While configuring complex SharePoint automations, you still need a reliable tool for drafting the documents that will populate those sites. WPS Office is a fast, lightweight, and completely free alternative to Microsoft Office.
- 1. Download the Installer: Visit the official WPS Office website to download the free installation package for your operating system.
- 2. Create or Edit Files: Open WPS Office to instantly start a new document or edit your existing Microsoft Office files without formatting loss.
- 3. Save and Upload: Save your work in standard Office formats and easily upload them directly to your newly provisioned SharePoint document libraries.

Frequently Asked Questions
Why doesn't Get-SPOSiteScriptFromWeb include page content?
The Get-SPOSiteScriptFromWeb cmdlet is specifically designed to capture the structural elements of a site, such as lists, libraries, themes, and navigation configurations. It is not intended to copy individual document content, list items, or site page contents.
Can I use Power Automate to copy SharePoint Site Pages?
Yes, Power Automate can be combined with SharePoint REST API calls or HTTP requests to trigger page creation and duplicate page content, though utilizing PnP PowerShell remains the industry standard for comprehensive site template deployments.
What is the difference between a SharePoint Site Script and a Site Template?
A Site Script is a JSON file detailing specific programmatic actions to apply (like creating a list or setting a theme). A Site Template (formerly called a Site Design) is the overarching package presented to users, which can execute one or multiple Site Scripts upon the site's creation.




