четверг, 6 декабря 2012 г.

Exchange 2010 PowerShell Scripts

Database size and last backup:
(get-mailboxdatabase -status) | foreach-object {write-host $_.lastfullbackup $_.databasesize}
(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

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 –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



Комментариев нет:

Отправить комментарий