Get All SharePoint Online Site Collections Inventory using PowerShell
Requirement: Get all site collections inventory in SharePoint Online using PowerShell
PowerShell to Get All SharePoint Online Site Collections Inventory:
Let's get list of SharePoint Online sites using PowerShell
Here is the List of all properties you can retrieve from a SharePoint Online site collection:
PnP PowerShell to Get Site Collection Details in SharePoint Online
Here is the PowerShell to get SharePoint Online site detailed info:
PowerShell to Get All SharePoint Online Site Collections Inventory:
Let's get list of SharePoint Online sites using PowerShell
Import-Module Microsoft.Online.SharePoint.Powershell -DisableNameChecking #Config Parameters $AdminSiteURL="https://crescent-admin.sharepoint.com" $ReportOutput="C:\Temp\SPOStorage.csv" #Get Credentials to connect to SharePoint Admin Center $Cred = Get-Credential #Connect to SharePoint Online Admin Center Connect-SPOService -Url $AdminSiteURL –Credential $Cred #Get All site collections $SiteCollections = Get-SPOSite -Limit All Write-Host "Total Number of Site collections Found:"$SiteCollections.count -f Yellow #Array to store Result $ResultSet = @() #Loop through each site collection and retrieve details Foreach ($Site in $SiteCollections) { Write-Host "Processing Site Collection :"$Site.URL -f Yellow #Get site collection details $Result = new-object PSObject $Result | add-member -membertype NoteProperty -name "Title" -Value $Site.Title $Result | add-member -membertype NoteProperty -name "Url" -Value $Site.Url $Result | add-member -membertype NoteProperty -name "LastContentModifiedDate" -Value $Site.LastContentModifiedDate $Result | add-member -membertype NoteProperty -name "Status" -Value $Site.Status $Result | add-member -membertype NoteProperty -name "LocaleId" -Value $Site.LocaleId $Result | add-member -membertype NoteProperty -name "LockState" -Value $Site.LockState $Result | add-member -membertype NoteProperty -name "StorageQuota" -Value $Site.StorageQuota $Result | add-member -membertype NoteProperty -name "StorageQuotaWarningLevel" -Value $Site.StorageQuotaWarningLevel $Result | add-member -membertype NoteProperty -name "Used" -Value $Site.StorageUsageCurrent $Result | add-member -membertype NoteProperty -name "CompatibilityLevel" -Value $Site.CompatibilityLevel $Result | add-member -membertype NoteProperty -name "Template" -Value $Site.Template $Result | add-member -membertype NoteProperty -name "SharingCapability" -Value $Site.SharingCapability $ResultSet += $Result } #Export Result to csv file $ResultSet | Export-Csv $ReportOutput -notypeinformation Write-Host "Site Quota Report Generated Successfully!" -f Greenand the result:
Here is the List of all properties you can retrieve from a SharePoint Online site collection:
- LastContentModifiedDate
- Status
- ResourceUsageCurrent
- ResourceUsageAverage
- StorageUsageCurrent
- LockIssue
- WebsCount
- CompatibilityLevel
- DisableSharingForNonOwnersStatus
- Url
- LocaleId
- LockState
- Owner
- StorageQuota
- StorageQuotaWarningLevel
- ResourceQuota
- ResourceQuotaWarningLevel
- Template
- Title
- AllowSelfServiceUpgrade
- DenyAddAndCustomizePages
- PWAEnabled
- SharingCapability
- SandboxedCodeActivationCapability
- DisableCompanyWideSharingLinks
- DisableAppViews
- DisableFlows
- StorageQuotaType
- SharingDomainRestrictionMode
- SharingAllowedDomainList
- SharingBlockedDomainList
#Config Parameters $AdminSiteURL="https://crescent-admin.sharepoint.com" $ReportOutput="C:\Temp\SPOStorage.csv" #Get Credentials to connect to SharePoint Admin Center $Cred = Get-Credential #Connect to SharePoint Online Admin Center Connect-SPOService -Url $AdminSiteURL –Credential $Cred #Get all Site collections details and Export to CSV Get-SPOSite -Limit ALL -Detailed | Export-Csv -Path $ReportOutput -NoTypeInformation
PnP PowerShell to Get Site Collection Details in SharePoint Online
Here is the PowerShell to get SharePoint Online site detailed info:
#Config Variables $SiteURL = "https://crescenttech.sharepoint.com/sites/Marketing" #Connect to PnP Online Connect-PnPOnline -Url $AdminCenterURL -Credentials (Get-Credential) #Get the site collection $Site = Get-PnPTenantSite -Url $SiteURL -Detailed #Get Site collection details Write-host "Title:" $Site.Title Write-host "Url:" $Site.Url Write-host "Subsites Count:" $Site.WebsCount Write-host "Last Content Modified Date:" $Site.LastContentModifiedDate Write-host "Status:" $Site.Status Write-host "Lock State:" $Site.LockState Write-host "Storage Quota:" $Site.StorageMaximumLevel Write-host "Storage Quota Warning Level:" $Site.StorageWarningLevel Write-host "Used:" $Site.StorageUsage Write-host "Compatibility Level:" $Site.CompatibilityLevel Write-host "Template:" $Site.Template Write-host "Sharing Capability:" $Site.SharingCapability Write-host "Site Owner:" $Site.OwnerMy Another post on getting all site collections using PowerShell in SharePoint Online: Get All Site Collections using PowerShell
No comments:
Please Login and comment to get your questions answered!