Exchange 2010: Get the list of ActiveSync Devices

Copy and paste the script into Windows Powershell ISE (or Notepad if you like) and save it as ASDevices.ps1. Simply run this script on Exchange Shell with sufficient permissions. It will generate an CSV file on the script location named MobileDevics.csv.


    Script Name: ASDevices.ps1

    Purpose: Generate a report of Active Sync Devices for all mailboxes.

    It lists     the user name (mailbox name), device name 

    (e.g., iPhone, Android) and device OS version number details. 


    Written By: Anand, the Awesome, Venkatachalapathy

    Written Date: November 4th 2012



#Creating an empty array to store the device details

$ActiveSyncDevices = @()


#Get a list of Mailbox servers in the enterprise

$MbxServers = Get-MailboxServer


#for each mailbox server...

foreach ($server in $MbxServers)


  #for each mailbox in the mailbox server...

  foreach ($Mailbox in Get-Mailbox –Server $server.Name -Resultsize Unlimited) 


    "Processing $($Mailbox.Identity)"


    #Get ActiveSync device details and store it in the array

    Get-ActiveSyncDeviceStatistics -Mailbox $Mailbox.Identity –ErrorAction SilentlyContinue | `

    Select DeviceFriendlyName, Devicetype, DeviceUserAgent | `

    ForEach-Object { $_ | Add-Member –MemberType NoteProperty -Name "MailboxIdentity" -value $Mailbox

    $ActiveSyncDevices += $_ }



#cover teh arrary into csv file

$ActiveSyncDevices | Export-csv ./MobileDevices.csv


# - - - - - - - End of the Script - - - - - - - - -


5 thoughts on “Exchange 2010: Get the list of ActiveSync Devices

  1. Super. Can we add a filter where it generates it for last 30 days. I added where {$_.lastsuccesssync -gt ’11/01/2012′} but it exported it to a 0 kb csv

  2. Hello Anand,

    I have copied and pasted the above script, however getting an error on the below lines
    #Get a list of Mailbox servers in the enterprise

    $MbxServers = Get-MailboxServer

    Could you please email me the proper script, we are having a parent and child domain scenario. in my domain i only have two cas server.

    so could you please help me in getting the list of users who are using Apple devices (iPhone & iPad)
    Also I am able to find the list by the below command

    $devices = Get-CASMailbox -Filter {hasactivesyncdevicepartnership -eq $true -and -not displayname -like “CAS_{*”}
    $devices | foreach-Object {Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity | Select-Object DeviceFriendlyName,Identity,DisplayName,DeviceType,DeviceUserAgent,FirstSyncTime,LastSuccessSync}| Export-Csv d:\Aziz\_activesyncdevices.csv

    However I don’t want the field identity and how can identity replaced by email address or alias or display name.

    Thank in Advance

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s