Forum Discussion

Blair24's avatar
Blair24
Copper Contributor
Nov 28, 2018

Using PowerShell to change page banner image

Hi Folks, Currently have a automatic site creation tool up and running. I know using the PnP engine no content will be included in the template, but is there any way on the newly created site on t...
  • Rahul Suryawanshi's avatar
    Nov 28, 2018

    Blair,

    I believe you are trying to change home page banner image programmatically. You can use PnP Powershell to do that. Follow below steps:

     

    1. Connect your site using
         Connect-PnPOnline -Url $siteUrl -Credential $credential

    2. Get Client Side Page
        $myHomePage = Get-PnPClientSidePage -Identity Home.aspx

    3. Set custom page header:
       $myHomePage.SetCustomPageHeader('<Server relative Image URL>')

    4. Save the page:
         $myHomePage.Save()

    5. Publish:
         $myHome.Publish()

     

     

    Let me know if it helped.

Resources