How to Create an ActiveSync Device Report

Exchange logs quite a bit of info about ActiveSync device partnerships and you can use this to create reports about the utilization of mobility features in your organization. Getting this data requires a couple of intermediate steps before you can export it to a CSV for processing in something like Excel (or another script). The PowerShell script below will export all of the ActiveSync device relationships in your organization. Keep in mind that this will include old relationships which are no longer active. Depending on how large your organization is and the number of device relationships out there, it may take a little while for the script to run.

Note: If you have a mixed version organization (e.g. Exchange 2007 and Exchange 2010), you’ll need to run the script twice. Once in the Exchange 2007 Management Shell and once in the Exchange 2010 Management Shell. The cmdlets used here are not backwards (or forward compatible). I’ve provided two versions of the script - one for Exchange 2007 and one for Exchange 2010.

Exchange 2007 Version

$devices = @()
$mailboxes = Get-CASMailbox -ResultSize:Unlimited | Where-Object {$_.HasActiveSyncDevicePartnership -eq $true -and $_.ExchangeVersion.ExchangeBuild -ilike "8*"}

foreach ($m in $mailboxes) 
{
	$devices += Get-ActiveSyncDeviceStatistics -Mailbox $m.Identity
}

$devices | Export-Csv DeviceStats.csv

Exchange 2010 Version

$devices = @()
$mailboxes = Get-CASMailbox -ResultSize:Unlimited | Where-Object {$_.HasActiveSyncDevicePartnership -eq $true -and $_.ExchangeVersion.ExchangeBuild -ilike "14*"}

foreach ($m in $mailboxes) 
{
	$devices += Get-ActiveSyncDeviceStatistics -Mailbox $m.Identity
}

$devices | Export-Csv DeviceStats.csv

You can open the exported CSV in Excel from here and generate reports based on that. There is quite a bit of information in the report including some personally identifiable information (PII) for the devices so keep that in mind before redistributing the raw data file.

Posted Sunday, January 31 2010 5:42 PM by Brian Desmond | 2 Comments
Tagged as: , ,

Comments, Trackbacks, & Pingbacks

#1 re: How to Create an ActiveSync Device Report

Friday, March 05 2010 8:27 AM by teknologist

Thanks for this!

The only downside to this for me is that I can't trust my stats on my 2007 Exchange server...for example, I know the person in the cube next to me has an Iphone that she syncs because I helped her set it up...but she doesn't appear on this report at all. Not sure if it's the script or the server but something is up.

#2 re: How to Create an ActiveSync Device Report

Tuesday, March 09 2010 10:33 AM by Aaron Perrault

Great report. Is there a way to only get users in a specific OU? We move all of our disabled users to a specific OU that is outside of our standard user OUs, and i would love to just run this against people in the active user OUs.

Great script though.

app

Leave a comment