Listing ExchangeActiveSync users assigned to a specific ActiveSync policy
This process outlines the steps to find all users in an organization assigned to a particular ActiveSync policy
-
Exchange ActivePolicy Name used here is “Admins”
- First you need to specify a “variable” for the name of the policy which you wish to extract a report. If you skip this step, you will end up querying ActiveSync mailbox policy for all users in the organization.
To do so, open the exchange management shell and type:
$ActiveSyncPolicyName = (Get-ActiveSyncMailboxPolicy “Admins“).Identity.DistinguishedName
Here, replace Admins with the name of your ActiveSync policy
- Now, run the cmd-let which will extract “only” the users assigned with the policyname “Admins”. For ease, ft it to the parameters as shown:
Get-CASMailbox -Filter {ActiveSyncMailboxPolicy -eq $ActiveSyncPolicyName} |ft Displayname, ActiveSyncMailboxPolicy, Servername
DisplayName | ActiveSyncMailboxPolicy | ServerName |
———– | ———————– | ———- |
Affleck, Ben | Admins | Exch2 |
Lee, Bruce | Admins | Exch5 |
Rajan, Sunder | Admins | Exch1 |
Keating, Ronan | Admins | Exch1 |
Ronald, Allen | Admins | Exch1 |
Nair, Meera | Admins | Exch5 |
Nair, Ratish | Admins | Exch3 |
So as you can see, these are the list of users assigned the Exchange ActiveSync policy named “Admins”
Ratish Nair
MVP Exchange
Team@ MSExchangeGuru
Keywords: Get list of users assigned to an activesync policy, Get-ActiveSyncMailboxPolicy list of users, list of users using one activesync policy.
February 12th, 2011 at 11:23 am
Ratish,
It’s funny, I just had a need to do this the other day and had to write my own snippet of powershell to accomplish it. I tried a slightly different approach where the variable doesn’t have to be declared before hand
Get-CASMailbox | where{$_.activesyncmailboxpolicy -match “”}
February 12th, 2011 at 11:25 am
Ooops, guess it didn’t like my formatting. between the double quotes you would put the name of the activesync policy you’re needing so to use your example of admins it would be Get-CASMailbox | where{$_.activesyncmailboxpolicy -match “Admins”}
April 4th, 2013 at 3:40 am
[…] Listing ExchangeActiveSync users assigned to a specific ActiveSync policy. (cmdlet […]
December 11th, 2013 at 10:32 am
I recently needed to pull all users with a particular ActiveSync policy. With over 100k mailboxes in our environment, this is exactly what I was looking for! Since I’m not an “Exchange guy” anymore, but script quite a bit of PowerShell for AD, I would have been fumbling thru the various Exchange PS cmdlets for hours. Thank you very much for posting this blog entry!
February 5th, 2014 at 12:07 pm
I took Kjell’s one liner and took it a little further. This will grab only the mailboxes with Active Sync enabled, as they are the only ones I care about, and output their name and the policy they are attached to:
Get-CASMailbox | where {$_.ActiveSyncEnabled -eq “True”} | Select-Object Name,ActiveSyncMailboxPolicy |Sort-Object ActiveSyncMailboxPolicy
June 7th, 2014 at 10:18 am
Could you please helping me in how to Set Mailbox ActiveSync Policy for users in specific OU?
June 7th, 2014 at 10:29 am
i got this script but not working with me, also i don’t know if $sam is mean the exchange host or not also i dont know where i can putting my ative sync policy in these mentioned script
foreach ($user in (
get-user -organizationalunit “ou=users,ou=santa clara,dc=zohno,dc=com”)) {
$sam = $user.samaccountname
Set-CASMailbox -identity $sam -ActiveSyncMailboxPolicy (Get-ActiveSyncMailboxPolicy “All Users Active-Sync Policy”).Identity
#Write-Host $sam
}