Configure

Update SharePoint Page Banner Image

This sample script shows how to update the banner image at the top of the SharePoint online modern page using PnP PowerShell

Summary

This sample script shows how to update the banner image at the top of the SharePoint online modern page using PnP PowerShell and CLI for Microsoft 365.

Scenario inspired from this blog post: Update SharePoint Page Banner Image using PnP PowerShell

Outupt Screenshot

powershell

# SharePoint online site url
$siteUrl = "https://contoso.sharepoint.com/sites/wlive"	

# Name of the site page
$pageName = "Open-Door-Policy"

# Server relative URL of the image to use in site page header
$imageUrl = "/sites/wlive/SiteAssets/work-remotely.jpeg"

# Connect to SharePoint Online site  
Connect-PnPOnline -Url $siteUrl -Interactive

# Update site page banner image
Set-PnPPage -Identity $pageName -HeaderType Custom -ServerRelativeImageUrl $imageUrl

Contributors

Author(s)
Ganesh Sanap

Disclaimer

THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

Tool documentation & references

Keep exploring