Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Converts the string output of Get-MailboxFolderStatistics into MB that can be sorted.Not the easiest to read but functional. Only needed when running the CmdLet remotely.
Get-MailboxFolderStatistics test@test.com | Select-Object name, @{
Name="FolderSize";
Expression={
[math]::Round(([regex]::matches($_.FolderSize,'\(([^\}]+)\)').value -replace 'bytes', '' -replace '\(', '' -replace '\)', '' -replace ',', '') / 1MB, 2)
}
} | Sort-Object FolderSize -Descending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.