Database size and last backup:
(get-mailboxdatabase -status) | foreach-object {write-host $_.lastfullbackup $_.databasesize}
Mailboxes
(get-mailboxdatabase) | foreach-object {write-host $_.name (get-mailbox -database $_.name).count}
it will display all the exchange server in the domain, and their database, and the number of its mailbox
$exchservers = Get-Exchangeserver
foreach($exchserver in $Exchservers)
{
get-mailbox -Server $exchserver.name | Group-Object Database | Select-object Count,Name,Databasesize,Lastfullbackup
$exchserver.name
}
Get-MailboxStatistics [username] | ft DisplayName, TotalItemSize, ItemCount
This shows us the size of the mailbox in bytes, as well as the number of items, and the username
Get-MailboxStatistics [username]
This shows the DisplayName, ItemCount, StorageLimitStatus, and LastLogonTime fields for the specified user
List mailboxes by mailbox database
Get-Mailbox | Sort database, name | Format-Table name, database
that you can use to get a nice readout of how many users you have in each database:
Get-MailboxDatabase | Select Server, StorageGroupName, Name, @{Name="Number Of Mailboxes";expression={(Get-Mailbox -Database $_.Identity | Measure-Object).Count}} | Format-Table -AutoSize
- Фильтр по полю Name:
Get-mailbox -Database "Mailbox Database 0589676007" -arbitration | ft Name
Moving Mailboxes:
Get-moverequest|get-moverequeststatistics
Get-moverequest –MoveStatus InProgress
Get-moverequeststatistics | select DisplayName,PercentComplete,TotalMailboxSize,BytesTransferedPerMinute
System Mailboxes:
Get-Mailbox -server <ServerName> -arbitration
Get-Mailbox -database <DataBaseName> -arbitration
Clear Queue
Remove-Message -Identity <MessageIdentity> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [-WithNDR <$true | $false>]
Remove-Message -Filter <String> [-Confirm [<SwitchParameter>]] [-Server <ServerIdParameter>] [-WhatIf [<SwitchParameter>]] [-WithNDR <$true | $false>]
Remove-Message -Server mailserver1 -Filter {FromAddress -eq “jon@yahoo.com.tw”} WithNDR $false
Remove-Message -Server mailserver1 -Filter {MessageSourceName -eq “SMTP:RelayConnector”} WithNDR $false
http://www.binaryroyale.com/index.php/2011/05/clearing-down-queues-on-exchange-2010-spam-attack/
http://www.petri.co.il/getting-mailbox-sizes-in-powershell.htm
http://msexchangeguru.com/2011/02/25/powershell-tips/