Skip to content

Instantly share code, notes, and snippets.

@bentaylorwork
Created August 18, 2017 10:21
Show Gist options
  • Save bentaylorwork/25d68b9e90c20c52080445a3af1d4b94 to your computer and use it in GitHub Desktop.
Save bentaylorwork/25d68b9e90c20c52080445a3af1d4b94 to your computer and use it in GitHub Desktop.
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