Number of active active sync devices connected to Exchange

Happy Monday everyone,  I haven’t posted anything in a while so I thought I would do a quick post of a short script I wrote the other day.  I was curious how many ActiveSync devices connected that were actively being used in our Exchange.  So after scouring around and discovering the get-mobiledevicestatistics cmdlet for Exchange I came up with the below.

get-mailbox -resultsize unlimited | foreach {Get-MobileDeviceStatistics -mailbox $_.Identity  | Where-Object {$_.LastSuccessSync -gt "06/01/2017"} | select-object identity, LastSuccessSync }

This will give you the identity of the device and the last successful sync time.  You could then pipe this into a export-csv to get a copy of the report or measure-object  to get a count of the objects.   Make sure to change the LastSuccessSync date.

Have a great week everyone.