3 August, 2015

Android Stagefright: Exchange PowerShell Snippets

So, this Stagefright thing sounds bad. We'll obviously know more later this week about how bad it is. If you're a BYOD happy organisation, right now you need to know how your organisation will be affected; how many Androids do you have, what versions, etc, and then what steps you'll need to take to remotely wipe/quarantine/block devices. And you don't want to be spending all night doing it. PowerShell to the rescue!

First, create an export directory, and assign Full Control permissions to the Exchange Trusted Subsystem group - I've used D:\ExchangeExport in these examples. Next, get a list of all your Android devices:

Get-MobileDevice
    | where {$_.DeviceOs -like "*Android*" -or $_.DeviceOs -match ""}
    | Export-Csv -path D:\ExchangeExport\android.csv

Some devices don't provide a DeviceOs, and devices that have been migrated from Exchange 2010 to 2013 seem to sometimes have an empty DeviceOs string, so you'll have to manually filter these. Next, get their last sync time (to determine devices which haven't been seen in a while) with:

Get-MobileDevice
    | where {$_.DeviceOs -like "*Android*" -or $_.DeviceOs -match ""}
    | foreach { Get-MobileDeviceStatistics -Identity $_.Identity }
    | Export-Csv -path D:\ExchangeExport\android-stats.csv