List Users with ActiveSync Disabled using Powershell

We can find and list users with ActiveSync disabled using the Powershell cmdlet Get-CASMailbox. This article contains Powershell script to get a list of ActiveSync disabled mailbox users and export user details to CSV file.

Before proceed, run the following command to enable Exchange Powershell cmdlets if you are working with normal Powershell console instead of Exchange Management Shell.

Add-PSSnapin *Exchange*

List Exchange ActiveSync Disabled Users

The Get-CASMailbox cmdlet returns the status of mailbox features (OWA, Exchange ActiveSync, POP3, and IMAP4) for all users, we can use Where-Object and filter only users with Exchange ActiveSync disabled.

Get-CASMailbox -ResultSize Unlimited | Where-Object { $_.ActiveSyncEnabled -eq $false}

You can get users from specific container (OU) by adding the parameter OrganizationalUnit.

$OU='OU=TestOU,DC=TestDomain,DC=com'
Get-CASMailbox -OrganizationalUnit $OU -ResultSize Unlimited |
Where-Object { $_.ActiveSyncEnabled -eq $false}

Export ActiveSync Disabled Users to CSV

The following powershell script exports Exchange ActiveSync disbaled users to CSV file.

Get-CASMailbox -ResultSize Unlimited | Where-Object { $_.ActiveSyncEnabled -eq $false} |
Select Name,ActiveSyncEnabled,OWAEnabled |
Export-CSV "C:\ActiveSyncDisabledUsers.csv" -NoTypeInformation -Encoding UTF8
Advertisement

1 thought on “List Users with ActiveSync Disabled using Powershell”

Leave a Comment