Tuesday, June 6, 2017

How to get a list of ActiveSync users and devices from command line.

$mbx=get-mailbox

$mbx | foreach {$name = $_.name; $alias = $_.alias; $device = get-activesyncdevicestatistics -mailbox $_.identity; $device | foreach {write-output "$alias;$name;$($_.devicefriendlyname);$($_.deviceid);$($_.LastSuccessSync)"} } >list.txt

This is the output. One line for each mobile device.

smithb;Smith, Bob;iPad Air;Appl345SDFGDFG;06/06/2017 16:05:01
smithb;Smith, bob;iPhone 7;SDFGD987938798;06/05/2017 16:06:00
...

No comments: