1

I want to get the total size for all our SharePoint sites (including OneDrive sites), where i tried to run this PnP command:-

Get-PnPTenantSite -IncludeOneDriveSites -Detailed

but i could not get the size of the sites.. can anyone advice on this please? Thanks

1 Answer 1

2

This works for me:

$sites =Get-PnPTenantSite -IncludeOneDriveSites

foreach($s in $sites)
{
  write-host "Usage:$($s.StorageUsage) MB `t MaxLevel:$($s.StorageMaximumLevel) MB `t Url:$($s.Url)"

} 

MS Doc reference

Updating to confirm PnP PowerShell returns values in MBs

To manually check the allocated quota follow steps 1 and 2.

  1. Click on Settings gear and then select Site Settings
  2. In the "Site Settings" page, under "Site Collection Administration", click on Storage Metrics

enter image description here

  1. To convert 25600 GB to MB, multiply with 1024 (1 GB = 1024 MB), which gives 26214400 MB

  2. Compare this with the PnP PS output value of StorageMaximumLevel, which in my case is MaxLevel:26214400 MB

Conclusion: PnP PowerShell returns Storage Metrics in MBs

7
  • thanks a lot, but can i get the total size of all those sites as one number?
    – John John
    Commented Nov 25, 2020 at 22:09
  • will this satisfy my need $sites =Get-PnPTenantSite -IncludeOneDriveSites $t=0; foreach($s in $sites) { write-host "Usage:$($s.StorageUsage) MB t MaxLevel:$($s.StorageMaximumLevel) MB t Url:$($s.Url)" $t=$t+$s.StorageUsage } write-host $t
    – John John
    Commented Nov 25, 2020 at 22:11
  • 1
    I think so. You can manually check the returned value for couple of them by going into the site collection then Storage metrics to make sure the number is accurate. If the individual numbers are accurate, sum should work. Commented Nov 25, 2020 at 22:23
  • thanks for the reply,, but from where i can confirm that the StorageUsage will be in MB and not in GB?
    – John John
    Commented Nov 25, 2020 at 22:41
  • can you advice on my above comment? just to make sure that the size will be in MB before i accept your answer...thanks
    – John John
    Commented Nov 27, 2020 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.