Microsoft - Exchange - PowerShell - Mobile devices

Report of all mobile devices syncing with Exchange

Tested with Exchange Server 2013 and higher, and Exchange Online.

Simple overview:

Get-MobileDevice -ResultSize Unlimited | `
Select-Object `
Identity,FriendlyName,DeviceOS, `
DeviceUserAgent,ClientVersion,ClientType `
| Format-Table -AutoSize

Larger report with last sync time:

# First export mobile device entries of ClientType REST as
# Get-MobileDeviceStatistics doesn't work on them.
Get-MobileDevice -ResultSize Unlimited | `
Where-Object {$_.ClientType -eq "REST"} | `
Select-Object `
  Identity, `
  FriendlyName, `
  DeviceOS, `
  DeviceModel, `
  DeviceType, `
  DeviceUserAgent, `
  ClientVersion, `
  FirstSyncTime, `
  DeviceAccessControlRule, `
  DeviceAccessState, `
  DeviceAccessStateReason | `
Export-Csv `
-Path C:\Temp\ExchangeMobileDeviceStatistics_REST.csv `
-NoTypeInformation
 
# Now export the devices that are not of ClientType REST.
$objMobileDevices = Get-MobileDevice -ResultSize Unlimited | `
Where-Object {$_.ClientType -ne "REST"}
$objDevices = @()
foreach ($objMobileDevice in $objMobileDevices) {
  $objDevice = Get-MobileDeviceStatistics `
  $($objMobileDevice.Guid | Select-Object -expandProperty GUID) | `
  Select-Object `
  Identity, `
  DeviceFriendlyName, `
  DeviceOS, `
  DeviceModel, `
  DeviceType, `
  DeviceUserAgent, `
  Status, `
  ClientVersion, `
  ClientType, `
  IsRemoteWipeSupported, `
  DevicePolicyApplied, `
  DevicePolicyApplicationStatus, `
  FirstSyncTime, `
  LastPolicyUpdateTime, `
  LastSyncAttemptTime, `
  LastSuccessSync, `
  DeviceAccessControlRule, `
  DeviceAccessState, `
  DeviceAccessStateReason
  $objDevices += $objDevice
}
$objDevices | Export-Csv `
-Path C:\Temp\ExchangeMobileDeviceStatistics.csv `
-NoTypeInformation

Sources: