Archive

Posts Tagged ‘Exchange 2010 powershell’

Powershell: Exchange – List all mailboxes in one database


To list all mailboxes in one database and sort it by size, use this nice PowerShell line:

Get-MailboxStatistics -Database <DATABASENAME> | select DisplayName, ItemCount, TotalItemSize | Sort-Object TotalItemSize -Descending

 

If you want to export the list to an CSV file, put “| Export-CSV C:\MailBoxSize.CSV” at the end of the PowerShell line.

Get list of mail sent and received on Exchange 2010


To get an list of emails running in and out from your exchange server you can use this powershell to retrieve all emails.

Get-TransportServer | Get-MessageTrackingLog -Start “12/03/2012 12:00am” -ResultSize Unlimited -EventId “receive” | Where {$_.Recipients -like “address@domain.com”}

-EventId has the following syntaxes:
BADMAIL
DEFER
DELIVER
DSN
EXPAND
FAIL
POISONMESSAGE
RECEIVE
REDIRECT
RESOLVE
SEND
SUBMIT
TRANSFER

And you can change -like “address@domain.com” to for example -match “@domain.com” to get ALL emails.

%d bloggers like this: