Powershell - how to - get mailbox samaccount and mailbox stats
Hi,
I was wondering if someone could help me some Exchange powershell.
I'm trying to get, from all users, their SamAccountName and their TotalItemSize (from the Get-MailboxStatistics command) output to table format.
SamAccountName TotalItemSize
I can obiviously get them by running two seperate commands however I can't seem to combine them so they output to a table.
Any help would be appreciated
August 1st, 2011 6:53pm
On Mon, 1 Aug 2011 22:46:29 +0000, 1ill wrote:
>
>
>Hi,
>
>I was wondering if someone could help me some Exchange powershell.
>
>I'm trying to get, from all users, their SamAccountName and their TotalItemSize (from the Get-MailboxStatistics command) output to table format.
>
>SamAccountName TotalItemSize
>
>I can obiviously get them by running two seperate commands however I can't seem to combine them so they output to a table.
>
>Any help would be appreciated
Try this (modify as needed):
$r=@();get-mailbox | foreach {$l = ""|Select Account,Size; $l.account
= $_.samaccountname; $l.Size = (get-mailboxstatistics -id
$_.distinguishedname).totalitemsize; $r += $l}; $r | export-csv
c:\temp\name.csv -notype -encoding ascii
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
August 1st, 2011 11:02pm
Hi Rich,
I've done a quick test and that seems to work! awesome. Thanks a lot.
Cheers,
Garry
August 2nd, 2011 2:22am