Table of Contents
SharePoint Online PowerShell
Why should we use PowerShell to Manage SharePoint Online? If you’re a SharePoint administrator, you know that PowerShell is your best friend. With PowerShell, you can automate many tasks that would otherwise take a long time to complete. Not just that, There are several reasons why we use PowerShell:
- Perform bulk operations – E.g. Applying settings to all sites, document libraries, etc.
- Generate reports – E.g., Export all user permissions from a site
- Certain operations can be done and available only through PowerShell
- Query and Filter the data
- Configure services, Manipulate objects, etc.
Install the SharePoint Online PowerShell module
1️⃣ Right click on the Windows start icon then open Windows PowerShell Admin or Terminal Admin in Windows 11.
2️⃣ Copy then paste all below commands into PowerShell window at once to install SharePoint online PowerShell module and connect to SharePoint online PowerShell.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force
Install-PackageProvider -Name NuGet -Force
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Update-Module -Name Microsoft.Online.SharePoint.PowerShell
Connect-SPOService
3️⃣ Now, you need enter the URL of your organization SharePoint admin. You can get it by visit Microsoft 365 admin center | SharePoint admin center.
PS C:\> Connect-SPOService
cmdlet Connect-SPOService at command pipeline position 1
Supply values for the following parameters:
Url: https://bbguides-admin.sharepoint.com/
4️⃣ A new small window opens, let’s sign-in using a global admin account.
5️⃣ Once done, you can run the following command to verify it works.
Get-SPOSite
Url Owner Storage Quota
--- ----- -------------
https://bbguides.sharepoint.com/sites/m365g 26214400
https://bbguides.sharepoint.com/sites/BonBen599 26214400
https://bbguides.sharepoint.com/sites/BonBen 26214400
https://bbguides.sharepoint.com/ 26214400
https://bbguides.sharepoint.com/sites/SSPS 1048576
https://bbguides.sharepoint.com/search 26214400
https://bbguides-my.sharepoint.com/ 26214400
Not a reader? Watch this related video tutorial: