Monday, December 15, 2014

ActiveSync maintenance in O365

I manage a hybrid O365 + On-premises Exchange 2010 environment.  As such, general management is a bit of a pain, as I still have a handful of production users on-prem.  These are mostly contractors, and we kept them on-premises to avoid hitting our O365 license cap.  I like to have a bit of padding there.

Long story short, I need to report on associated ActiveSync devices in our environments. In either case this is fairly simple, but to combine the data I need to correlate info from Exchange 2010 and O365.

Let's start with O365.  The current command is Get-MobileDevice [see also: Get-MobileDeviceStatistics].  This can be piped out via Select and we can get relevant Properties.  Once we get relevant fields down, we will send this to CSV for consumption.

Get-MobileDevice | Select -Property UserDisplayName,DeviceType,DeviceModel,FriendlyName,DeviceOS,DeviceTelephoneNumber,DeviceAccessState,WhenChanged


  • UserDisplayName - Display name of user mailbox owning the Device.
  • DeviceType - Class of Device connection.  iPhones are straightforward, but other manufacturers give any kind of info you could imagine.
  • DeviceModel - Similar to DeviceType, iPhones are clearly enumerated, others not so much.
  • FriendlyName - This is the Device Name as assigned by it's owner.  Typically "so-and-so's iPhone" or similar.
  • DeviceOS - Helpful when running reports to know what device versions are connecting.  
  • DeviceTelephoneNumber - another useful bit of info.
  • DeviceAccessState - Allowed or Blocked, defines whether a given device has been blocked for ActiveSync.
  • WhenChanged - I was hoping for a "last check-in", but this isn't it.  This merely shows when the connection was configured or updated.  A device system update seems to cause the info to change/refresh and changes this value.
This covers the O365/Exchange Online portion.  I piped Export-CSV to the end to deliver a consumable document.

Exchange 2010 is a bit of a different beast.  Since this is the on-premises environment, I'll have fewer entries overall.

Get-ActiveSyncDevice | Select -Property UserDisplayName,DeviceType,DeviceModel,FriendlyName,DeviceOS,DeviceTelephoneNumber,DeviceAccessState,WhenChanged

Note that here, the UserDisplayName returns the full cn from LDAP.  That's not as friendly as it is in 2013/O365.  Otherwise, the dataset matches well.