Monday, July 8, 2013

Exchange 2010 Mailbox Server Maintenance Commands

Determining Free Space in an Exchange 2010 Mailbox Database
------------------------------------------------------------
Get-MailboxDatabase -Status | ft name,databasesize,availablenewmailboxspace -auto

List top 30 Mailboxes Size
--------------------------
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,TotalItemSize -First 30

List top 100 Mailboxes Size and export to CSV file
---------------------------------------------
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,TotalItemSize -First 100 | Export-CSV top100mailboxes.csv

Determine Exchange Server 2010 Services Status
-----------------------------------------------
Get-Service | Where {$_.DisplayName -Like "Microsoft Exchange*"}

Determine both Exchange Servers services
----------------------------------------
Get-exchangeserver | test-servicehealth


Test Mailflow
----------------
Test-Mailflow -TargetEmailAddress 'zawhtet@mmx.com'


Restart Exchange Services
-------------------------
Get-Service | ? { $_.name -like "MSExchange*" -and $_.Status -eq "Running"} foreach ($service in $services) {Restart-Service $service.name -Force}
OR
Get-wmiobject win32_service | ? {$_.name -like "MSExchange*" -and $_.StartMode -eq "Auto"} foreach ($service in $services) {Restart-Service $service.name -Force}


Determine Disconnected Mailboxes by Database
---------------------------------------------
Get-MailboxStatistics -Database "Dbase-1" | Where-Object {$_.DisconnectDate -Notlike $NULL} | FL DisplayName, DisconnectDate, MailboxGuid
Get-MailboxStatistics -Database "
Dbase-2" | Where-Object {$_.DisconnectDate -Notlike $NULL} | FL DisplayName, DisconnectDate, MailboxGuid
Get-MailboxStatistics -Database "
Dbase-3" | Where-Object {$_.DisconnectDate -Notlike $NULL} | FL DisplayName, DisconnectDate, MailboxGuid
Get-MailboxStatistics -Database "
Dbase-4" | Where-Object {$_.DisconnectDate -Notlike $NULL} | FL DisplayName, DisconnectDate, MailboxGuid

Remove Mailbox by SID
---------------------
Remove-Mailbox -Database "Dbase-1" -StoreMailboxIdentity x.x.x.x.x.x.x.

OAB Update
-----------
1.Restart 'Microsoft Exchange System Attendant'
2. On CAS server run 'Update-FileDistributionService -Identity ygn-cas-2k8 -Type OAB'


Defrag Mailbox Database offline to clean the white space
--------------------------------------------------------
http://exchangeserverpro.com/defrag-exchange-2010-mailbox-database/


Reconnect Mailbox if you had disable
--------------------------------------------
Connect-Mailbox -Identity "zawhtet" -Database 'Finance & Accounting Team' -User 'Zaw Htet' 


Clear VSS Copy
--------------
Vssadmin list shadows
Diskshadow> list shadows all
Diskshadow>delete shadows all 



No comments: