Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DWSR/456ce9c47e391dc0a11c38a9d6adf4de to your computer and use it in GitHub Desktop.
Save DWSR/456ce9c47e391dc0a11c38a9d6adf4de to your computer and use it in GitHub Desktop.
function Get-LAFolderSize {
Param(
[Parameter(
Mandatory = $true,
ValueFromPipelineByPropertyName = $true,
ValueFromPipeline = $true
)]
[String]$upn
)
Begin {
$resultArray = New-Object System.Collections.Generic.List[Hashtable]
}
Process {
$mboxsize = Get-MailboxStatistics $upn | select-Object -ExpandProperty TotalItemSize
$reitemsize = (Get-MailboxFolderStatistics $upn -FolderScope RecoverableItems)[0] | select -ExpandProperty FolderandSubfolderSize
$resultArray.Add(
[Ordered]@{
UserPrincipalName = $upn
RecoverableItemsSize = $reitemsize
TotalSize = $mboxsize
}
)
}
End {
return $resultArray
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment