Exchange PowerShell notes

Get all SMTP addresses in domain:

Get-Recipient | Select Name -ExpandProperty EmailAddresses | Select Name,  SmtpAddress

Get mailbox statistics (sort by MailBox Size):

Get-mailbox | Get-MailboxStatistics | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}},@{label=”Items”;expression={$_.ItemCount}},@{label=”Storage Limit”;expression={$_.StorageLimitStatus}} -auto

Get mailbox statistics (sort by Last Logon Time):

Get-mailbox | Get-MailboxStatistics | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object LastLogonTime –Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}},@{label=”Items”;expression={$_.ItemCount}},@{label=”Storage Limit”;expression={$_.StorageLimitStatus}},@{label=”Last Logon Time”;expression={$_.LastLogonTime}} -auto

Get mailbox statistics (sort by Last Logon Time with DB):

Get-mailbox | Get-MailboxStatistics | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object LastLogonTime –Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”DataBase”;expression={$_.Database}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}},@{label=”Items”;expression={$_.ItemCount}},@{label=”Storage Limit”;expression={$_.StorageLimitStatus}},@{label=”Last Logon Time”;expression={$_.LastLogonTime}} -auto

Mailbox DB send quota:

Get-mailboxdatabase | fl IssueWarningQuota,ProhibitSendQuota,ProhibitSendReceiveQuota
Set-mailboxdatabase -IssueWarningQuota unlimited -ProhibitSendQuota unlimited -ProhibitSendReceiveQuota unlimited

Transport and connectors quota:

Get-TransportConfig | fl MaxReceiveSize, MaxSendSize
Get-ReceiveConnector | fl maxMessageSize
Get-SendConnector | fl maxmessagesize

Personal send/receive quotas:

get-mailbox |ft Name, Maxsendsize, maxreceivesize