Managing SharePoint Online requires some level of automation, depending on the size of your tenant. One common requirement you’re likely to have is retrieving site properties, such as
- Storage quota
- Owners
- Status
SharePoint Online’s admin centre provides an overview of site details, but for bulk reporting this script is far more efficient – you can very quickly gather key information across multiple sites without manually checking each one.
Before running the script, you’ll need the following:
- Microsoft.Online.SharePoint.PowerShell installed
- SharePoint Administrator role for your tenant
- PowerShell 5
Here’s a simple script to fetch site properties:
# Define the admin center URL $adminCenterURL = "https://yourdomain-admin.sharepoint.com" # Connect to SharePoint Online Connect-SPOService -Url $adminCenterURL # Define the site URL $siteURL = "https://yourdomain.sharepoint.com/sites/YourSite" # Get site properties $siteProperties = Get-SPOSite -Identity $siteURL # Display results Write-Output "Site URL: $($siteProperties.Url)" Write-Output "Storage Used: $($siteProperties.StorageUsageCurrent) MB" Write-Output "Storage Quota: $($siteProperties.StorageQuota) MB" Write-Output "Owner: $($siteProperties.Owner)" Write-Output "Status: $($siteProperties.Status)" # Disconnect from SharePoint Online Disconnect-SPOService
You could retrieve all sites rather than using Get-SPOSite, and then loop through them without too much effort.