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, Ive 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.

Im 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, Ive experienced that this property isnt 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.

10 thoughts on “Getting an overview of all ActiveSync devices in the Exchange-organization

  1. 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?

  2. 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

  3. Pingback: Kalender Sync Probleme mit iDevices und Exchange 2010 ›› hochwald.net

  4. 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?

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

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

  6. this would be everything i need but i get an error when trying to run against exchange 2007

    Missing opening ‘(‘ after keyword ‘for’.
    At C:\Documents and Settings\administrator\easusers.ps1:16 char:15
    + For m <<<< ore information, see the following blog-post:

  7. To show DisplayName instead of samaccountname just modify line
    $deviceinfo.User = $mailbox.samaccountname
    to
    $deviceinfo.User = $mailbox.DisplayName
    in the end of the script

    The script works very well for me. Thank you.