Get-EASDeviceReport.ps1 Script to Report on ActiveSync Devices

Recently I was asked whether I had any PowerShell scripts available for producing a simple report of the ActiveSync devices for an Exchange organization. I didn’t have a script at the time but was able to quickly put one together that did the job, though it was a little rough.

I’ve since updated the script to make it more functional and reliable, and I am releasing it here for the community to download and make use of as well.

This script is available for download by Exchange Server Pro Insiders. Join here it’s free.

Simply run the script in the Exchange Management Shell to produce the report in CSV format.

[PS] C:\Scripts>.\Get-EASDeviceStatsReport.ps1

The report is written to a CSV file in the same folder that the script is located.

easdevicereport

You can also send the CSV report via email, and specify an “age” in days for the last sync attempt of the device, for example to only report on devices that have not attempted sync in 30 days.

PS C:\Scripts> .\Get-EASDeviceReport.ps1 -Age 30 -SendEmail -MailFrom exchangeserver@exchangeserverpro.net -MailTo administrator@exchangeserverpro.net -MailServer smtp.exchangeserverpro.net

get-easdevicereport-email

Questions and feedback are welcome in the comments below.

About Paul Cunningham

Paul is a Microsoft Exchange Server MVP and publisher of Exchange Server Pro. He also holds several Microsoft certifications including for Exchange Server 2007, 2010 and 2013. Find Paul on Twitter, LinkedIn or Google+, or get in touch for consulting/support engagements.

Comments

  1. Martin Eddy says:

    It works like it says on the box.

  2. nice work!

    just a sidenote, had to add “-encoding unicode” to export-csv for our norwegian special chars, ÆØÅ

  3. Hi Paul,
    Is there a way to run this on individual servers?
    In the middle of a 2007 – 2010 migration so the mailboxes are split.

    It comes back with the ‘You must use V14′ error.

  4. Shane Bryan says:

    Hmm, I’m logged in but I can’t get the download link for the script to appear. When I click on the “Join Here it’s free” link it takes me to a page that says “Welcome, you’re already logged in”.

  5. Shane Bryan says:

    Ahh never mind, the downloads are on another page. Sorry all :-p

  6. FYI all I’ve uploaded V1.02 which has that UTF8 encoding fix and also fixes another minor bug with the file path for the CSV file.

  7. Paul,
    Just to clarify, when adding the -Age 30 to the script with csv output, the Sync Age column is how many days ago the device last synced?

  8. Hi,
    great, as usual, but not working in a multidomain environment. I need something like “Set-AdServerSettings -ViewEntireForest $True” in the shell initialization and “-ResultSize unlimited” in the get-ActiveSyncDevice” but I really don’t know how to do the trick.
    Regards.

    Red.

  9. Hi,

    Is there anyway we could get the script to show the current time versus UTC and maybe a sort on the most recently sync’d device?

    Thank you a ton!

    Ryan

  10. Hi Paul,

    First of all thank you very much for all the great scripts that you put out for us, it really does make our lives that much easier.
    When I run the script a few of my DeviceID’s are been truncated, i.e. the DeviceID appears as 5.1535E+29. Is there a way around this?

    Thanks

  11. Hi Paul,

    I figured out what the problem is. The report sends a .CSV attachment which if you open directly by double clicking it from within Outlook Excel will open and truncate the long numbers. You have to open Excel then import the CSV, when you get to step 3 you need to highlight the DeviceID column and change it from General to Text. This will stop Excel from automatically truncating long numbers.

    Thanks

  12. there are various users which activesync account is enabled and under manage phone option none of the device is appearing due to this i am unable to remove mobile phone partnership or perform a remote wipe.

    and this kind of accounts are not getting captured in this script. Kindly suggest how to capture these kind of activesync enabled users through this script.

    • I don’t really understand your question.

      The script reports on ActiveSync device partnerships. It uses Get-CASMailbox to find users with EAS device partnerships. If there is no partnerships for a user then the device won’t be included in the report.

      Are you saying you have devices with no partnership that you’d like to report on?

      • Pradeep says:

        Apologies for delay and thanks for responding to my query. Yes i would like to capture even those account whose active sync account is enabled and not yet activated there device. So you under stand correct that i have devices with no partnership that you’d like to report on. Kindly suggest, How we can achieve this.

        • All users are enabled for ActiveSync by default.

          And until a device has connected and a partnership has been created, it can’t be reported on.

  13. Hi Paul,

    I was wondering if there any way to get this report to give information such as MAC address? I see you have device I.D just as I’m trying to create a white list on our wireless connections and wanted to use this for referencing.

    Thanks, Mark

  14. Gavin Connell-Otten says:

    Hi Paul, nice job dude :)

    Any tips for getting this going with Exchange Online (Exch2013)?

    Cheers,

    Gavin

  15. Gavin Connell-Otten says:

    Scrap that question, figured it out. I just commented out the Exchange snap in check stuff and made sure I already had the cmdlets loaded in my remote powershell session. Works well for Office 365, thanks!

  16. Great script, I also had the same question as Mark if you can pull the MAC address attribute from async.

  17. We are in the process of implementing an MDM solution and moving all EAS devices to it. I want to run the script to clean up devices that have not connected in xx days, but I also need to skip devices that are enrolled through MDM. When I run the get-activesyncdevice | get-activesyncdevicestastics command, I get an output that shows a column labled DeviceAccessStateReason. The values are “global” for devices connected directly to EAS and “individual” for devices managed through the MDM.

    Is there a way to modify the script to only find devices that have not connected xx days and have DeviceAccessStateReason=global?

    Thanks,
    Tony

  18. Pivattos says:

    Very very very Nice!!! Wonderfull!!! Save My Work!!!! Tks!!!

  19. Ok. I feel like a complete idiot but I really want to see this script. I signed up and signed in, but still do not see a link to download the scipt.
    Thanks very much.

  20. Never mind. I found it.

Leave a Comment

*

We are an Authorized DigiCert™ SSL Partner.