Wednesday, 15 July 2015

Get Exchange Mailbox Features using Powershell

We can use the Exchange Powershell cmdlet Get-CASMailbox to get all the mailbox features, it returns whether the mailbox features (OWA, Exchange ActiveSync, POP3, and IMAP4) are enabled or disabled.

Before proceed, run the following command to enable Exchange cmdlets if you are working with Powershell console instead of Exchange Management Shell.
Add-PSSnapin *Exchange*
The below command gets all the features for all mailboxes.
Get-CASMailbox -ResultSize Unlimited
You can add the parameter Identity if you want to get a single user's mailbox feature.
Get-CASMailbox -Identity "Morgan"
You can add the parameter OrganizationalUnit if you want to get the features of a users from specific container (OU).
$OU='OU=TestOU,DC=TestDomain,DC=com'
Get-CASMailbox -OrganizationalUnit $OU -ResultSize Unlimited
By default, it returns all the features, you can use Select command if you want to get only selected features list.
Get-CASMailbox -ResultSize Unlimited | Select Name,ActiveSyncEnabled,OWAEnabled

List Mailbox Users with ActiveSync Enabled:

Use the following command to list only ActiveSync feature enabled users.
Get-CASMailbox -ResultSize Unlimited | Where { $_.ActiveSyncEnabled -eq 'True'}
Like this, you can also filter with other features. The below command lists only users with OWA Enabled.
Get-CASMailbox -ResultSize Unlimited | Where { $_.OWAEnabled -eq 'True'}

Export All User's Mailbox Features to CSV:

Use the below powershell script to export mailbox features of all users to CSV file.
Get-CASMailbox -ResultSize Unlimited |
Select Name,ActiveSyncEnabled,OWAEnabled,PopEnabled,ImapEnabled,MapiEnabled |
Export-CSV "C:\\MailBoxFeatures.csv" -NoTypeInformation -Encoding UTF8
The following script exports only users with ActiveSync Enabled
Get-CASMailbox -ResultSize Unlimited | Where { $_.ActiveSyncEnabled -eq 'True'} |
Select Name,ActiveSyncEnabled,OWAEnabled |
Export-CSV "C:\\ActiveSyncEnabledUsers.csv" -NoTypeInformation -Encoding UTF8

Advertisements
Advertisements

No comments:

Post a Comment