This seems to work.
$mbx_stats = @()
Get-MailboxStatistics -Server <servername> |% {
$mbx = "" | select name,size,dn,cn
$mbx.name = $_.displayname
$mbx.size = $_.totalitemsize
if (get-mailbox $_.legacydn){
$mbx.dn = (Get-Mailbox $_.legacydn).distinguishedname
$mbx.cn = (Get-Mailbox $_.legacydn).organizationalunit
$mbx_stats += $mbx
}
}
$mbx_stats | Export-Csv stats.csv -notype
"Jon LaBarge" wrote:
> I am having trouble finding a good way to export Exchange 2007 mailbox
> statistics. Here's what I need to do:
>
> Export a CSV that includes:
> 1.) User name (which is no problem)
> 2.) Mailbox Size in MB (which is also no problem)
> 3.) The Distinguished Name or Container Name of the user (HUGE problem)
>
> I need this to be done for only one server and the get-mailbox |
> get-mailboxstatistics -server <servername> cmdlet allows this, but I cannot
> for the life of me figure out how to add the DN or CN to the query.
>
> Anyone know a way to do this?
>
> TIA!
>
> Jon
>
>
>