How to Create a SharePoint Modern Site With PnP Powershell

How to Create a SharePoint Modern Site With PnP Powershell

It has been a while since Microsoft released modern pages for SharePoint. Since most people still use the older, classic sites, not everyone knows how to create a SharePoint modern site using PnP PowerShell.

Fortunately, it is not really that complicated. By following this tutorial, you can be done in only a few minutes. There is no need to worry about the code since all you have to do is copy and paste them.

Let’s start!

What is a modern site in SharePoint?

As its name suggests, a modern site in SharePoint is a complete design overhaul over how classic sites look. If you can have used the new Microsoft 365 applications, then you will see some semblance in the design.

Here is a screenshot of what a SharePoint modern site page looks like (taken from the SharePoint Look Book): 

How a SharePoint modern site looks like

All modern sites are designed to work flawlessly on mobile. The user interface, even on mobile, is so much better compared with that of a classic site. Editing a modern page also feels like you are using a modern page builder like WordPress.

Here is an example of how a classic site looks like:

How a SharePoint classic site looks like

In the case of a classic site, you will have to configure the design yourself for it to look good on mobile. This is a known issue since classic sites do not shrink or respond according to the screen size that you are using.

Be that as it may, the fortunate truth is that there is a way to transform a classic site into a modern site, albeit not that easy. That is why if you are planning on creating a SharePoint site, better go straight to modern.

What are the types of modern sites you can create?

Basically, there are two types of modern sites that you can make:

  1. Team
  2. Communication

A modern team site is more like a project site or a department site that teams use to collaborate. It is a place where you and your team can share content, information, and various apps like Teams, Planner, and Outlook.

Here is an example of a modern team site:

Modern team site looks

On the other hand, a modern communication site is a place where you can share vast information with others like news, reports, and updates. A communication site always looks more appealing as everyone in the organization visits it regularly.

Here is an example of a modern communication site:

Modern communication site looks

Should you create a team site or a communication site?

Since the introduction of communication sites, some users are confused about whether they should build a team site or a communication site. Before, classic sites look more or less similar to a team site.

Once you try creating either one, you will realize that there is a vast difference between the two.

For example, you will notice that a team site has a quick launch menu on its left-hand side pane, which is why it is often called an office 365 group site template. You will be able to open various apps right away.

That same quick launch menu is absent on a communication site. The reason for this is that you do not get any other apps like Planner or Teams with a communication site. What you get is a modern site that looks like a customer-facing site.

Some use cases for a team site include:

  • Project sites
  • Client sites
  • Department sites

Some use cases for a communication site include:

  • New product launch site
  • Employee-facing site
  • Internet landing page

If you are still confused, remember this: 

For collaboration purposes, build a team site. If you need a place to make certain announcements or post updates to let the whole organization know about the news, then build a communication site.

How to create a modern site in SharePoint?

Creating a modern site in SharePoint is easy, especially with the manual method. The second method will require that you have some knowledge on how to use PnP PowerShell, which is what I will show you later on.

The Manual Method

If you are using SharePoint Online, then this method is the most intuitive to use. All it requires of you is to click a few buttons, enter some details, and you’re done.

The first step is to log in to your root site. No matter where you land off, all you need to do is click on the app launcher and select “SharePoint” from the list of apps.

Open SharePoint from the quick launcher

Once you’re there, the next step is to click on the “Create site” button. Then, select the type of modern site that you want to create.

Select the type of modern site to create

If you create a team site, you will have to provide the following:

  • Site name (mandatory)
  • Group email address
  • Site address (automatic)
  • Site description (mandatory)
  • Privacy settings
  • Default site language
Modern team site tutorial

The next window will also enable you to add additional owners and members. If you don’t have anything to add, simply click “Finish” and your team site will be created.

Additional options for team site tutorial

If you want to create a communication site, you will have to provide the following:

  • Design (Topic, Showcase, Blank)
  • Site name (mandatory)
  • Site address (automatic)
  • Site description (mandatory)
  • Default site language
Modern communication site tutorial

After clicking “Finish”, your communication site will be created.

Using PnP PowerShell

To create a modern site using PnP PowerShell, you need to install it first in SharePoint Online, which will cover the first part of this section. If you already have the latest module installed, you can step the steps below.

How to install PnP PowerShell

On your computer, open Windows PowerShell and run it as an administrator.

Run Windows PowerShell as administrator

Then, run the command below on Windows PowerShell (copy-paste it to the interface and hit “Enter”).

Install-Module SharePointPnPPowerShellOnline

If the latest module is already installed, nothing will happen. Otherwise, an installation will take place. To proceed, simply agree to the installation prompt.

Installing PnP PowerShell

Run two more commands on the PowerShell. What these will do is to enable you to avoid any blocked error messages when using the PnP PowerShell.

Get-ExecutionPolicy

Set-ExecutionPolicy RemoteSigned

It should look like this:

Commands to avoid blocked error messages

How to use PnP PowerShell

Naturally, the way to do this is through code. Fortunately, it’s not really that hard to do as you only have to copy and paste the code in here.

To start, open Windows PowerShell ISE and run it as an administrator.

Run Windows PowerShell ISE as administrator

To create a modern team site, change some of the details on the code below, copy and paste it to PowerShell ISE, and run it.

# Connect to SharePoint Online

# This command will prompt the sign-in UI to authenticate

Connect-PnPOnline -Url https://yoursite.sharepoint.com;

# Create the new "modern" team site

$teamSiteUrl = New-PnPSite -Type TeamSite -Title "New Modern Team Site" -Alias "newmodernteamsite" -Description "description" -IsPublic

Make sure to change the following:

  • SharePoint site URL
  • Title
  • Alias
  • Description
How to create a modern team site with PNP PowerShell

As for creating a new modern communications site, here is the script:

# Connect to SharePoint Online

# This command will prompt the sign-in UI to authenticate

Connect-PnPOnline -Url https://yoursite.sharepoint.com;

# Create the new "modern" communication site

$communicationSiteUrl = New-PnPSite -Type CommunicationSite -Title "New Modern Communication Site" -Url "https://yoursite.sharepoint.com/sites/newmoderncommunicationsite" -Description "description" -Classification "classification" -SiteDesign Topic

Make sure to change the following:

  • SharePoint site URL
  • Title
  • New modern communication site URL
  • Description
  • Site Design (Topic, Showcase, Blank)
How to create a modern communication site with PNP PowerShell

You can then check your SharePoint admin to see the new sites:

How to create a modern sites with PNP PowerShell

That’s it! If you have any other questions, feel free to leave a comment below or send me a direct message via the contact page.

About Ryan

As the Principal Solutions Architect at Mr. SharePoint, I help companies of all sizes better leverage the Modern Workplace and Digital Process Automation investments.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Tweet
Share
Share
Pin