How to Fix PowerShell Not Copying All SharePoint Page Content
Question details
The user needs to resolve an issue where a PowerShell migration script misses specific SharePoint page elements like themes, banners, and call-to-action sections.

- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- Migrating SharePoint pages and content using a customized PowerShell script.
- Observed behavior
- The script successfully copies most files and pages, but fails to copy the theme, a banner, and a call-to-action section. Additionally, some internal links still point to the original source site.
Ensure you have the latest version of the SharePoint Online Management Shell installed and verify that your user account has SharePoint Administrator permissions.
Consult the Microsoft Q&A SharePoint Customization Forum
Since this involves a custom PowerShell script, the best approach is to get tailored advice from Microsoft's developer community.
Custom PowerShell scripts often require specific modules or API calls to handle intricate page components like custom web parts, themes, and link rewriting during a migration.
Copy your custom PowerShell script and sanitize it by removing any sensitive credentials or tenant URLs.
Open your web browser and go to the Microsoft Q&A website, then search for the SharePoint Customization tag.
Create a new thread detailing the missing components (themes, banners, CTA) and the link redirection issue, pasting your sanitized script for community review.

Verify and Update PnP PowerShell Modules
Outdated PowerShell modules may lack support for newer SharePoint modern page components.
Manage Your Documents Effectively with WPS Office
While SharePoint handles complex site migrations, WPS Office is the perfect lightweight alternative for managing, editing, and sharing your everyday documents. Enjoy high compatibility with Microsoft Office formats without the hefty subscription fees.
- 1. Download WPS Office: Visit the official WPS Office website and click the free download button for your operating system.
- 2. Install the software: Run the downloaded installer and follow the on-screen instructions to set up WPS Office on your computer.
- 3. Open and edit files: Launch WPS Office and open your migrated Word, Excel, or PowerPoint files to continue working seamlessly.

Frequently Asked Questions
Why do my SharePoint links still point to the old site after migration?
When migrating pages using standard file-copy commands in PowerShell, the hardcoded URLs inside text or web parts are not automatically updated. You need to use specific PnP PowerShell commands or implement script logic that finds and replaces the source URL with the destination URL.
Can PowerShell copy SharePoint modern page themes?
Yes, but it requires applying the theme settings explicitly to the destination site using cmdlets like 'Set-PnPWebTheme' or 'Invoke-PnPTenantTemplate'. Standard page copy commands often only copy the page content, not the site-level theme settings.
What is the best way to migrate SharePoint modern pages via script?
For custom scripts, utilizing the PnP.PowerShell module (specifically commands like Export-PnPPage and Invoke-PnPSiteTemplate) is highly recommended. For extremely complex migrations, official tools like the SharePoint Migration Tool (SPMT) might be more reliable than a custom script.




