Exchange - Trying to get list of all users with mobile devices.

I’m running Exchange 2010 SP3.

I’m trying to make an export that will tell me what users in my origanization are using active sync, and how perhaps have many devices they have.

I would imagine an easy way of achiving it, would be:
Get-Mailbox -server “servername” | Get-ActiveSyncDeviceStatistics | ft DeviceType, DeviceUserAgent, LastSuccessSync
but it does not seem to work.

All I get is errors saying
The ActiveSyncDevice domain01\users\Tim cannot be found
+ CategoryInfo : NotSpecified: (991:Int32) [Get-ActiveSyncDeviceStatistics], ManagementObjectNotFoundException
+ FullyQualifiedErrorId : 81D1A14,Microsoft.Exchange.Management.Tasks.GetMobileDeviceStatistics

Even though this user does have a mobile device … does anyone have some good advice or idea ?

Sounds like you want exactly what is described in example 2 from the Get-ActiveSyncDeviceStatistics help:


This example uses the Get-CASMailbox cmdlet to determine who in the organization has a Microsoft Exchange ActiveSync mobile device. For each mobile device, the Exchange ActiveSync device statistics are retrieved.

$UserList = Get-CASMailbox -Filter {hasactivesyncdevicepartnership -eq $true -and -not displayname -like "CAS_{*"} | Get-Mailbox

$UserList | foreach { Get-ActiveSyncDeviceStatistics -Mailbox $_}

Just to add to that last comment, it seems like pipelining in a mailbox object doesn’t work because it takes the identity of that mailbox and tries to find it as if it were an ActiveSync device. That’s what I got from the error message you received anyway, and that is probably why in the example they pass the mailbox object directly into the -Mailbox parameter of Get-ActiveSyncDeviceStatistics.

I seem to get problems with hasactivesyncdevicepartnership. I get the following error.

Invoke-Command : Cannot bind parameter ‘Filter’ to the target. Exception setting “Filter”: “Invalid filter syntax. For
a description of the filter parameter syntax see the command help.
“hasactivesyncdevicepartnership -eq $true -and -not displayname -like “CAS_{*”” at position 70.”
At C:\Users\jack\AppData\Roaming\Microsoft\Exchange\RemotePowerShell\exchangeserver.domain01\exchangeserver.domain01.local.psm1:9466 char:29

  •         $scriptCmd = { & <<<<  $script:InvokeCommand `
    • CategoryInfo : WriteError: (:slight_smile: [Get-CASMailbox], ParameterBindingException
    • FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.Exchange.Management.RecipientTasks.GetCASMailbox

Keep in mind that is just an example, and I copied it from the online docs, but that may have something specific to Exchange 2013 that isn’t available in Exchange 2010. I’m not sure what version you are working with. I haven’t managed Exchange in quite a while, so I don’t have an environment set up where I can figure out the exact syntax you need.