Useful Commands - Exchange Management Shell in Exchange 2010

Exchange 2010

Solve Content Index Issue:

Display list of databases with content index issues:
Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq "Failed"}

Fix databases with content index issues by re-seeding their content index (this will not re-seed the entire database which is good):
Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq "Failed"} | Update-MailboxDatabaseCopy -CatalogOnly

Check Again to make sure all DB’s show as healthy:
Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq "Failed"}

Alternatively, here is the command to simply reseed the content index of a specific DAG database:
Update-MailboxDatabaseCopy -Identity “Remote 02\PDXEX2” -CatalogOnly

Quota management:

View only mailboxes that have exceeded their mailbox quotas

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | where {$_.StorageLimitStatus -notlike "BelowLimit*"} | Select DisplayName,StorageLimitStatus,@{name="TotalItemSize (MB)";expression={[math]::Round((($_.TotalItemSize.Value.ToString()).Split("(")[1].Split(" ")[0].Replace(",","")/1MB),2)}},@{name="TotalDeletedItemSize (MB)";expression={[math]::Round((($_.TotalDeletedItemSize.Value.ToString()).Split("(")[1].Split(" ")[0].Replace(",","")/1MB),2)}},ItemCount,DeletedItemCount | Sort "TotalItemSize (MB)" -Descending | Export-CSV "C:\My Documents\Exceeded Quotas.csv" -NoTypeInformation

Mailbox information:

View all information
Get-Mailbox renan.rodrigues | fl *

View quotas for a mailbox
Get-Mailbox renan.rodrigues | fl *quota*

View database for a mailbox
Get-Mailbox renan.rodrigues | fl *database*