Get all users activesync device versions

We need to use powershell to query exchange and get all users, the activesync device types, and the version they are on.  It needs to be spit out into a CSV or Excel file. Can someone help me with this?

jsmith | iPhone | iPhone,6.1
smith | Android | SamsungGalaxy10.1
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sajen JoseCommented:
You can probably use the below cmdlet and build a script around it by replacing the USERNAME using a foreach loop...  

Get-ActiveSyncDeviceStatistics -Mailbox USERNAME | format-table UserDisplayName, DeviceType, DeviceUserAgent, DeviceOS

You can find more information here ->
cmb991Author Commented:
Thanks, Ill try now, but I stink at writing scripts.  I'll try my best.  If I can't get it, can you help me?
Sajen JoseCommented:
sure, I don't have access to an Exchange Environment for testing out the scripts, however you can refer online (for e.g. ->, this will give you a good information to start building out the script by yourself :)
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

cmb991Author Commented:
I still can't get it to work.
Sajen JoseCommented:
Are you able to get it working for a single user with the above cmdlet? Are there any error messages coming up...
cmb991Author Commented:
Single user works fine.  It’s getting a loop in to do every mailbox i’m stuck on
cmb991Author Commented:
Can someone help me with getting this to work to pull every email address, their device manufacture, and device version?  Also needs to do non-disabled ad accounts.
Sajen JoseCommented:
$Mailboxes = Get-Mailbox -ResultSize unlimited

$Devices = $Mailboxes | %{Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity}

$Devices | Select-Object UserDisplayName, DeviceType, DeviceUserAgent, DeviceOS | Export-Csv -NoTypeInformation -Path "Devicedetails.csv"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Seth SimmonsSr. Systems AdministratorCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: Sajen Jose (https:#a42432439)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.