On Windows PowerShell and other admin-related topics

Getting an overview of all ActiveSync devices in the Exchange-organization

In Exchange 2007, we can get use the Get-ActiveSyncDeviceStatistics to retrieve statistics for a specific ActiveSync-device. We must supply either a device identity or a mailbox name. In Exchange 2010, the same cmdlet exists, but we also got a new useful cmdlet; Get-ActiveSyncDevice. This cmdlet lists all devices in the organization that have active Microsoft Exchange ActiveSync partnerships.

To provide a way to list all ActiveSync devices in the Exchange organization that works against both Exchange 2007 and Exchange 2010, I`ve created a script named Get-ActiveSyncDeviceInfo.ps1. The script outputs each device as an object, making it easy to work with the results. You might i.e. export all devices to a CSV-file by piping the results to Export-Csv.

You might also create graphs based on the results, like I demonstrated in a previous blog-post.

I`m aware that the script could be more effective, using Get-CASMailbox and a server-side filter to sort out only mailboxes that got the property HasActiveSyncDevicePartnership set to “true”. However, I`ve experienced that this property isn`t reliable. Several mailboxes that does have the HasActiveSyncDevicePartnership set to true doesn`t have an ActiveSync devices associated. You might want to use this approach anyway in larger organizations, although I chose to skip it and rather loop through all mailboxes.


September 26, 2010 - Posted by | Exchange ActiveSync, Exchange Server 2007, Exchange Server 2010, Scripting, Windows PowerShell |


  1. Hi. How can I export this to a csv using export-csv ?

    Comment by xyz123 | November 19, 2010 | Reply

    • Try this: .\Get-ActiveSyncDeviceInfo.ps1 | Export-Csv -Path $home\Documents\ActiveSync-devices.csv -NoTypeInformation

      Comment by Jan Egil Ring | November 21, 2010 | Reply

  2. It seems that MS devices and Android devices are not consistent in how they report anything. I can report I-phone and non-iphon but not really anything more. Have you found a way to pull what the device actually is?

    Comment by Kfoutts | January 7, 2011 | Reply

  3. When running this script against mailboxes in 2007 from Exchange 2010 Powershell it is generating a ton of “version” errors.

    The Get-ActiveSyncDeviceStatistics command that you are trying to run, which is version 14, requires that the target mailbox account is on a Mailbox server that is the same version. The command wasn’t able to process your request because the target mailbox account is on a Mailbox server with version 8. Please use this version (Version: 8) of the Get-ActiveSyncDeviceStatistics command.
    + CategoryInfo : InvalidArgument: (:) [Get-ActiveSyncDeviceStatistics], ServerVersionNotSupportedException
    + FullyQualifiedErrorId : 3CA4C53,Microsoft.Exchange.Management.Tasks.GetMobileDeviceStatistics

    Comment by Duane | June 22, 2011 | Reply

  4. […] -Filter "CalendarRepairDisabled -eq `$false" -ResultSize unlimitedAuf Technet ist ein Skript von Jan Egil Ring zu finden um iDevices zu identifizieren. Das Skript zeigt alle iDevices die am Exchange bekannt […]

    Pingback by Kalender Sync Probleme mit iDevices und Exchange 2010 ›› | November 21, 2011 | Reply

  5. The select-object statement gives me the error “the writeobject and writeerror methods cannot be called after the pipeline has been closed. Please contact Microsoft Support Services.” What’s up with that?

    Comment by Jeanne | February 1, 2012 | Reply

  6. I am having some trouble with the script – I get the following error

    Missing closing ‘}’ in statement block.
    At C:\Scripts\Get-ActiveSyncDeviceInfo.ps1:73 char:2
    + } <<<<
    + CategoryInfo : ParserError: (CloseBraceToken:TokenId) [], ParseException
    + FullyQualifiedErrorId : MissingEndCurlyBrace
    I have tried adding and removing the }

    Comment by Jeff James | March 27, 2012 | Reply

  7. Any idea how I can modify the script to report the users DisplayName rather than samaccountname?

    Comment by Nick | April 3, 2012 | Reply

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

%d bloggers like this: