In this post I will describe how to change the default home page in a SharePoint Online site user PowerShell.

Requirements

Lets Get Started

Knowing this command may be helpful if you want to change the default home page of a SharePoint site to the document library, list or a different page you setup on the site. In this example I will be changing the site to use the document library as the home page.

I will get requests from users for a SharePoint site that is going to be used majorly as a place to store and collaborate on documents, setting up the document web part on the home page is useful but it lacks some features that are in the full document library page and changing out the home page for the document library page solves these issues.

  1. Run the below command to connect to the SharePoint site you want to change.
Connect-PnPOnline -Url https://YOURTENANT.sharepoint.com/YOURSITEPATH -UseWebLogin

2. Once connected to the site run the below command to set the document library as the new home page for your site.

Set-PnPHomePage -RootFolderRelativeUrl 'Shared Documents/Forms/AllItems.aspx'

Now you should be all set, refreshing the page on your SharePoint site and the document library should be your new home page.

For more reading about the cmdlet used follow the link below 😊

Link: Set-PnPHomePage cmdlet