Created
June 12, 2017 01:00
-
-
Save kevinblumenfeld/b18c7a304693d913967d78617239e594 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-LAFolderSize { | |
Param( | |
[Parameter( | |
Mandatory = $true, | |
ValueFromPipelineByPropertyName = $true, | |
ValueFromPipeline = $true)] | |
[String]$userprincipalname | |
) | |
Begin { | |
$resultArray = @() | |
} | |
Process { | |
$mboxsize = Get-MailboxStatistics $userprincipalname | select-Object -ExpandProperty TotalItemSize | Select @{name = "Size"; expression = {[math]::Round((($_.Value.ToString()).Split("(")[1].Split(" ")[0].Replace(",", "") / 1GB), 2)}} | |
$reitemsize = (Get-MailboxFolderStatistics $userprincipalname -FolderScope RecoverableItems)[0] | select @{name = "Size"; expression = {[math]::Round((($_.FolderAndSubfolderSize.ToString()).Split("(")[1].Split(" ")[0].Replace(",", "") / 1GB), 2)}} | |
$hash = [Ordered]@{} | |
$hash['UserPrincipalName'] = $userprincipalname | |
$hash['RecoverableItemsSize'] = $reitemsize.size | |
$hash['TotalSize'] = $mboxsize.size | |
$resultArray += [psCustomObject]$hash | |
} | |
End { | |
return $resultArray | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment