Export list of mail enabled users from Exchange 2010

Use PowerShell to export a list of mail enabled users from Exchange 2010:

Get-User -ResultSize Unlimited | Where { $_.RecipientType -eq ‘UserMailbox’ } | ft firstname,lastname,samaccountname

The following command will export the list to a CSV file:

Get-User -ResultSize Unlimited | Where { $_.RecipientType -eq ‘UserMailbox’ } | select firstname,lastname,samaccountname | export-csv c:\MailEnabledUsers.txt