Listing Exchange ActiveSync Users and Device Details

As an IT administrator you must have come across a requirement from information security teams that they want to review the number of users who use emails on their mobile phones. Some companies require this data so that they can allow access only for selected users. Although listing users is not a big deal when you can use Get-CASMailbox -ResultSize Unlimited | ? {$_.HasActiveSyncDevicePartnerShip = $True} it is a bit of challenge for a novice powershell user to find out their device information too.

Below scriptlet is quite handy when it comes to finding EAS users and their handheld device details.

$ResultArr =@()
$CASMailboxes = Get-CASMailbox -ResultSize Unlimited | ? {$_.HasActiveSyncDevicePartnership -eq $true}
foreach ($CASMailbox in $CASMailboxes)
{

$ResultArr += Get-ActiveSyncDeviceStatistics -Mailbox $CASMailbox.Identity | Select @{Name=”User”;Expression={($CASMailbox.Name).ToString()}},DeviceType,DeviceModel,FirstSyncTime,LastSuccessSync,IsRemoteWipeSupported
}

$ResultArr | Export-Csv C:\Reports\EASDeviceStats.csv -NoTypeInformation

If you are lazy like me then you may want to send this information directly to someone using a bit of automation

Send-MailMessage -From “Support@company.com” -To “security@company.com” -Subject “ActiveSync User Stats” -Attachments C:\Reports\EASDeviceStats.csv ” -Body ” This is an autogenerated Email. Please do not respond to this email” -SmtpServer “ServerName”

I hope you find this useful!