Exchange 2019: Find which ActiveSync Policy is assigned to all mailboxes
For many organizations, ActiveSync plays a big part in terms of communication where end users either have email on company owned devices or personal devices.
Policies can be applied to certain users, for example, Executives or Senior Management may have a different Mobile device policy than what end users have. For a client recently I put together a quick script that could be exported to a CSV file to show if the default policy is assigned or specific ones to users.
In the command below, we make use of the Get-CASMailbox command (This was also tested against mailboxes in Office 365 and it provided the info), Here is the command used:
Get-CASMailbox | where{$_.activesyncmailboxpolicy -match ""} | Select Name,PrimarySmtpAddress,ActiveSyncMailboxPolicy,ActiveSyncMailboxPolicyIsDefaulted
Below is a screenshot of the output:
https://everything-powershell.com/wp-content/uploads/2022/06/image-1024x350.png
As this is a test lab, your organization may have hundreds if not thousands of users and a screen display will show a lot of information, we can use the same command but export it to a CSV file as below:
Get-CASMailbox | where{$_.activesyncmailboxpolicy -match ""} | Select Name,PrimarySmtpAddress,ActiveSyncMailboxPolicy,ActiveSyncMailboxPolicyIsDefaulted | Export-Csv "C:\Users\ActiveSyncPolicy.csv
Here is a screenshot of the command run, notice it does not give any information after it has run but the CSV file is exported:
https://everything-powershell.com/wp-content/uploads/2022/06/image-2.png
This is what the sample CSV file looks like, some information has been removed:
https://everything-powershell.com/wp-content/uploads/2022/06/image-3-1024x87.png