
Get All SharePoint Online Sites using PowerShell
Sites are the root component of SharePoint. Sites can be created directly or by creating new teams or private channels in Microsoft Teams. So, admins need to keep an eye on the list of sites available in their organization. This blog helps you find and export all the SharePoint Online site collections and their details using PowerShell.
You can use the Get-SPOSite cmdlet to retrieve a list of all site collections in the tenant. Before proceeding with the cmdlets, you must connect to the SharePoint Online PowerShell module.
After connecting to SharePoint Online, run the following cmdlet to view all site collections in SharePoint Online.
Get-SPOSite | ft Title,Url,Template,StorageQuota,LastContentModifiedTime,Owner
The above cmdlet lists all the SharePoint Online site collections, along with the Site Id, Site Template, Storage Quota, Site Owner, etc.
To export all the SharePoint Online site collections with specified properties, run the cmdlet as shown below.
Get-SPOSite | Select Title,Url,Template,StorageQuota | Export-Csv ./AllSPOSites.csv -NoTypeInformation
To get specific site details, execute the Get-SPOSite cmdlet with site id (I.e., site URL).
Get-SPOSite -Identity <site url> | select *
The above cmdlet shows 50+ properties of a site, including Site Id, Site Owner, Lock State, Sharing Capability, Storage Quota, Warning Quota, etc. You can view the required properties by mentioning them under the select filter.
You can also view all the SharePoint Online sites in the Grid view. It will be handy to filter, customize columns, sort rows, copy and paste data.
Get-SPOSite | Select Title,Url,Template,StorageQuota,LastContentModifiedDate,LockState,SharingCapability,Owner | Out-GridView
This blog will be helpful to get SharePoint Online sites and their properties. If you have any scripting requirements, share them with us through the comment section. We are happy to help!