Skip to content

Instantly share code, notes, and snippets.

@mirontoli
Last active April 6, 2021 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirontoli/edf2a63f1190067b09a963676052317f to your computer and use it in GitHub Desktop.
Save mirontoli/edf2a63f1190067b09a963676052317f to your computer and use it in GitHub Desktop.
# it calculates storage capacity in SharePoint Online
# read more on my blog post: https://chuvash.eu/?p=5360
$sku = Get-MsolAccountSku
$sku2 = $sku | % {
$s = $_;
$sr = [PSCustomObject]@{
SkuPartNumber = $s.SkuPartNumber;
Licenses = $s.ActiveUnits + $s.WarningUnits
Services = $s.ServiceStatus | % { $_.ServicePlan.ServiceName };
};
$sr
}
$sta = $sku2 | ? { $_.Services.Contains("SHAREPOINTSTANDARD") }
$ent = $sku2 | ? { $_.Services.Contains("SHAREPOINTENTERPRISE") }
$odb = $sku2 | ? { $_.Services.Contains("ONEDRIVE_BASIC") }
$sta_count = $sta | Measure-Object -Sum Licenses | Select -ExpandProperty Sum
$ent_count = $ent | Measure-Object -Sum Licenses | Select -ExpandProperty Sum
$odb_count = $odb | Measure-Object -Sum Licenses | Select -ExpandProperty Sum
$def = 1024
$stor_gb = $def + $sta_count*10 + $ent_count*10 + $odb_count*0.5
$stor_tb = $stor_gb / 1024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment