Using powershell to export Exchange mailbox attributes

This sample will search and find all mailboxes where the quotas of the mailbox is not unlimited and the mailbox should use the mailbox database defaults and then put it into a csv file.. I know it’s sound stupid, but in an Exchange 2003 and 2010 coexistence the problem above is real. Exchange 2010 using the quotas on the mailbox when you move it from thelegacy environment. To solve the issue basically you need to go through all the mailboxes and find where the statement above is true and then correct it using the Set-mailbox cmdlet. Here is the cmdlet:

Get-mailbox -ResultSize Unlimited | where {($_.ProhibitSendReceiveQuota -ne “unlimited” -or$_.ProhibitSendQuota -ne “unlimited” -or$_.IssueWarningQuota -ne “unlimited”) -and $_.UseDatabaseQuotaDefaults -eq ”true”} | select Name, PrimarySMTPAddress, UserPrincipalName, Database, ServerName, UseDatabaseQuotaDefaults, ProhibitSendQuota, ProhibitSendReceiveQuota, IssueWarningQuota | Export-CSV -Path c:\scripts\quotas.csv

 

This entry was posted in Exchange, Powershell. Bookmark the permalink.

Leave a comment