Handy Exchange Powershell commands for your daily uses!

1) Generate a mailbox statistics report for particular Exchange Database and Export it as CSV.

Get-MailboxStatistics -database “DATABASE” | sort TotalItemSize -Descending | select DisplayName,TotalItemSize | epcsv c:\temp\mailsize.csv

2) To check the white space on an Exchange Database.

Get-MailboxDatabase -Status -identity DATABASENAME | Sort-Object DatabaseSize -Descending | Format-Table Name, DatabaseSize, AvailableNewMailboxSpace

3) Clean mailbox database in Exchange 2013

Get-MailboxStatistics -Database DATABASE | ForEach { Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false }

4) Check the database content index status (Failed) and update the catalog.

a) This will return a result of all DB with Content Index State  failed.

Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq “Failed”}

b) By using the following command we can update the content index status of all the failed DBs.

Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq “Failed”} | Update-MailboxDatabaseCopy -CatalogOnly

c) Following command will help to narrow down to a particular failed database.

Update-MailboxDatabaseCopy -Identity DATABASE\ServerName -CatalogOnly

5) Report of mailboxes with custom mailbox quota settings.

get-mailbox | where {$_.UseDatabaseQuotaDefaults -eq $False} | select name,prohibit*,issue* | Export-CSV C:\Temp\MailboxQuota.csv -NoTypeInformation

Leave a Reply

Your email address will not be published. Required fields are marked *