SharePoint Online get size of sites in ROOT
Sergi Díaz Ruiz
240
Reputation points
Morning,
I should get a report for sites in ROOT path:
I need to do this with powershell and I'm using this script:
#Config Parameters
$AdminSiteURL="https://SITE.sharepoint.com"
$ReportOutput="C:\windows\Temp\SPOStorageRoot.csv"
$spoSize = Import-Csv "C:\Windows\Temp\rootSize.csv"
#Connect to SharePoint Online Admin Center with MFA
Connect-SPOService -Url $AdminSiteURL
#Array to store Result
$ResultSet = @()
ForEach ($spo in $spoSize) {
Write-Host "Processing Site Collection :"$spo.subsites -f Yellow
#Send the Result to CSV
$URL = "https://SITE.sharepoint.com"+$spo.subsites
$URL.StorageUsageCurrent
pause
$Result = new-object PSObject
$Result| add-member -membertype NoteProperty -name "SiteURL" -Value $URL
$SorageGB = [System.Math]::round($URL.StorageQuota*1MB/1GB,4)
$Result | add-member -membertype NoteProperty -name "Allocated" -Value $SorageGB
$UsedGB = [System.Math]::round($URL.StorageUsageCurrent*1MB/1GB,3)
$Result | add-member -membertype NoteProperty -name "Used" -Value $UsedGB
$Result | add-member -membertype NoteProperty -name "Warning Level" -Value $URL.StorageQuotaWarningLevel
$ResultSet += $Result
#Export Result to csv file
$ResultSet | Export-Csv $ReportOutput -notypeinformation
Write-Host "Site Quota Report Generated Successfully!" -f Green
}
But always return 0...
TIA
Microsoft 365 and Office | SharePoint | For business | Windows
11,684 questions
Sign in to answer