mawatson
asked on
Combine Get-MailboxFolderStatistics and Get-Mailbox
Hey folks.
I've recently been asked to slightly amend a simple Exchange Management Shell one-liner I put together a while ago.
It goes like this:
"ServerName" | Get-MailboxServer | Get-Mailbox -ResultSize unlimited | Get-MailboxFolderStatistic s | where {$_.ItemsInFolder -gt 4700} | Sort-object -descending ItemsInFolder | ft Identity, FolderPath, ItemsInFolder, @{Label="FolderSize(MB)";e xpression= {$_.Folder Size.ToMB( )} }, @{Label="FolderSize(MB)";e xpression= {$_.Folder AndSubfold erSize.ToM B()} } -a | out-file C:\ServerName-HighItemCoun t.txt -width 750
It will get the mailbox server, get each mailbox on said server and then get mailbox folder statistics where ItemsInFolder is greater than 4700 items. It'll sort the output descending by ItemsInFolder and dump out several other properties of the object.
However, what Get-MailboxFolderStatistic s does not do is show the Database or StorageGroup property of the mailbox. So, is there a way I can sort combine the two to show the StorageGroup property of the mailbox in question?? Perhaps with a variable?
Any help is much appreciated.
Cheers,
Matt
I've recently been asked to slightly amend a simple Exchange Management Shell one-liner I put together a while ago.
It goes like this:
"ServerName" | Get-MailboxServer | Get-Mailbox -ResultSize unlimited | Get-MailboxFolderStatistic
It will get the mailbox server, get each mailbox on said server and then get mailbox folder statistics where ItemsInFolder is greater than 4700 items. It'll sort the output descending by ItemsInFolder and dump out several other properties of the object.
However, what Get-MailboxFolderStatistic
Any help is much appreciated.
Cheers,
Matt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I took what you proposed and morphed it a bit to get this:
"ServerName" | Get-MailboxServer | Get-Mailbox -ResultSize unlimited | %{
$Mailbox = $_
Get-MailboxFolderStatistic
Select-Object Identity, FolderPath, ItemsInFolder, `
@{n='FolderAndSubfolderSiz
@{n='Database';e={ $Mailbox.Database }}
} | Sort-object -descending ItemsInFolder | ft -a | out-file C:\Server_FolderList.txt -width 750
Many many thanks for the feedback. This will be a helpful primer as reference for combining Exch Mgmt Shell cmdlets.
Cheers,
Matt