Easily Create A SharePoint Site Using PowerShell

Introduction

In this quick article we will demonstrate how to create a new SharePoint Site Collection using only PowerShell. You will need to be using an account that has the SharePoint Administrator role assigned that has access to your SharePoint Admin Center.

Launch SharePoint Management Shell

Open the SharePoint Management Shell as an administrator. This shell is specifically designed for managing SharePoint and provides the necessary cmdlets.

Load the SharePoint PowerShell Module (if needed)

In some environments, you may need to load the SharePoint module manually. If so, use the following command:

Import-Module Microsoft.Online.SharePoint.PowerShell

Skip this step if you have it always loaded.

Connect to your SharePoint Admin Center

You will need to access your SharePoint Admin Center address, for this you will need to have at the minimum a SharePoint Administrator role assigned to the account you will use.

Connect-SPOService -Url https://<your tenant>-admin.sharepoint.com

Gather the details for your new site

For the example I will create, I will use the following details:

  1. -Url is https://mytenant.sharepoint.com/sites/Sales2024
  2. -Owner is admin@mytenant.com
  3. -StorageQuota is 0 (no storage quota)
  4. -Title is “Sales 2024”
  5. -Template is SITEPAGEPUBLISHING#0 (which is for a Communication site)

Getting the available templates

To get the current list of available SharePoint templates for your environment, you can issue the command below. (Ensure you are already connected to your tenant (step above):

Get-SPOWebTemplate

Typically the most common templates to be used from SharePoint directly are for the Communication Site, or Team site (no Microsoft 365 Group).

Submit the command to create the SharePoint site

There are a number of options available for creating a new SharePoint site. Below is simple example, for a SharePoint site

New-SPOSite -Url https://<your tenant>.sharepoint.com/sites/<new site>-Owner <admin email> -StorageQuota 0 -Title “<new site title>” -Template SITEPAGEPUBLISHING#0

Below is my new SharePoint site created:

ADMIN
ADMIN

Leave a Reply

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