Exchange Administrators always want to know who and what is connecting to their Exchange environment. Commands like Get-ActiveSyncDevice and Get-ActiveSyncDeviceStatistics provide lots of information but leave out some of the desired details or make it hard to read. With that being said i have done a little reworking of a script written over at Glen’s Exchange Dev Blog to run right inside of the Exchange 2010 Management Shell.
In larger Exchange environments the get-mailbox command down in the code would need to be changed to get-mailbox -ResultSize unlimited.
If you want the output to be in a file change the last line from |FT to |Export-csv C:\Mobile.csv
$HWVersions = @{
"Apple-iPad" = "iPad";
"Apple-iPad1C1" = "iPad";
"Apple-iPad2C1" = "iPad 2";
"Apple-iPad2C2" = "iPad 2";
"Apple-iPad2C3" = "iPad 2";
"Apple-iPhone" = "iPhone";
"Apple-iPhone1C2" = "iPhone 3G";
"Apple-iPhone2C1" = "iPhone 3GS";
"Apple-iPhone3C1" = "iPhone 4";
"Apple-iPhone3C3" = "iPhone 4";
"Apple-iPhone4C1" = "iPhone 4S";
"Apple-iPod" = "iPod Touch";
"Apple-iPod2C1" = "iPod Touch 2";
"Apple-iPod3C1" = "iPod Touch 3";
"Apple-iPod4C1" = "iPod Touch 4";
}
$IOSVersions = @{
"508.11" = "2.2.1";
"701.341" = "3.0";
"701.400" = "3.0.1";
"702.367" = "3.2";
"702.405" = "3.2.1";
"702.500" = "3.2.2";
"703.144" = "3.1";
"704.11" = "3.1.2";
"705.18" = "3.1.3";
"801.293" = "4.0";
"801.306" = "4.0.1";
"801.400" = "4.0.2";
"802.117" = "4.1";
"802.118" = "4.1";
"803.148" = "4.2.1";
"803.14800001" = "4.2.1";
"805.128" = "4.2.5";
"805.200" = "4.2.6";
"805.303" = "4.2.7";
"805.401" = "4.2.8";
"805.501" = "4.2.9";
"805.600" = "4.2.10";
"806.190" = "4.3";
"806.191" = "4.3";
"807.4" = "4.3.1";
"808.7" = "4.3.2";
"808.8" = "4.3.2";
"810.2" = "4.3.3";
"810.3" = "4.3.3";
"811.2" = "4.3.4";
"812.1" = "4.3.5";
"901.334" = "5.0";
"901.405" = "5.0.1"
"902.179" = "5.1"
}
$Resultset = foreach($mbx in get-mailbox -ResultSize unlimited) {Get-ActiveSyncDeviceStatistics -Mailbox:$mbx.Identity |Select-Object @{name="Username";expression={$mbx.name}},DeviceType,@{name="Device";expression={$_.DeviceUserAgent.ToString().Split("/")[0]}},@{name="OSVersion";expression={$_.DeviceUserAgent.ToString().Split("/")[1]}},LastSuccessSync}
$Output= @()
ForEach ($Line in $Resultset) {
$Object = "" | Select-Object Username,DeviceType,Device,Version,LastSuccessSync
$Object.UserName= $line.Username
$Object.DeviceType =$Line.DeviceType
$Object.Device = $HWVersions.Get_Item($line.Device)
$Object.Version = $IOSVersions.Get_Item($line.OSVersion)
$Object.LastSuccessSync = $line.LastSuccessSync
$Output += $Object
}
$output |FT
"Apple-iPad" = "iPad";
"Apple-iPad1C1" = "iPad";
"Apple-iPad2C1" = "iPad 2";
"Apple-iPad2C2" = "iPad 2";
"Apple-iPad2C3" = "iPad 2";
"Apple-iPhone" = "iPhone";
"Apple-iPhone1C2" = "iPhone 3G";
"Apple-iPhone2C1" = "iPhone 3GS";
"Apple-iPhone3C1" = "iPhone 4";
"Apple-iPhone3C3" = "iPhone 4";
"Apple-iPhone4C1" = "iPhone 4S";
"Apple-iPod" = "iPod Touch";
"Apple-iPod2C1" = "iPod Touch 2";
"Apple-iPod3C1" = "iPod Touch 3";
"Apple-iPod4C1" = "iPod Touch 4";
}
$IOSVersions = @{
"508.11" = "2.2.1";
"701.341" = "3.0";
"701.400" = "3.0.1";
"702.367" = "3.2";
"702.405" = "3.2.1";
"702.500" = "3.2.2";
"703.144" = "3.1";
"704.11" = "3.1.2";
"705.18" = "3.1.3";
"801.293" = "4.0";
"801.306" = "4.0.1";
"801.400" = "4.0.2";
"802.117" = "4.1";
"802.118" = "4.1";
"803.148" = "4.2.1";
"803.14800001" = "4.2.1";
"805.128" = "4.2.5";
"805.200" = "4.2.6";
"805.303" = "4.2.7";
"805.401" = "4.2.8";
"805.501" = "4.2.9";
"805.600" = "4.2.10";
"806.190" = "4.3";
"806.191" = "4.3";
"807.4" = "4.3.1";
"808.7" = "4.3.2";
"808.8" = "4.3.2";
"810.2" = "4.3.3";
"810.3" = "4.3.3";
"811.2" = "4.3.4";
"812.1" = "4.3.5";
"901.334" = "5.0";
"901.405" = "5.0.1"
"902.179" = "5.1"
}
$Resultset = foreach($mbx in get-mailbox -ResultSize unlimited) {Get-ActiveSyncDeviceStatistics -Mailbox:$mbx.Identity |Select-Object @{name="Username";expression={$mbx.name}},DeviceType,@{name="Device";expression={$_.DeviceUserAgent.ToString().Split("/")[0]}},@{name="OSVersion";expression={$_.DeviceUserAgent.ToString().Split("/")[1]}},LastSuccessSync}
$Output= @()
ForEach ($Line in $Resultset) {
$Object = "" | Select-Object Username,DeviceType,Device,Version,LastSuccessSync
$Object.UserName= $line.Username
$Object.DeviceType =$Line.DeviceType
$Object.Device = $HWVersions.Get_Item($line.Device)
$Object.Version = $IOSVersions.Get_Item($line.OSVersion)
$Object.LastSuccessSync = $line.LastSuccessSync
$Output += $Object
}
$output |FT
Tweet



Pingback: Exchange 2010 ActiveSync Device Info « ExchangeBytes « JC’s Blog-O-Gibberish
great thanks, now how can i show a list of recovery passwords for each user.
Try
Changing
$Resultset = foreach($mbx in get-mailbox) {Get-ActiveSyncDeviceStatistics -Mailbox:$mbx.Identity |Select-Object @{name=”Username”;expression={$mbx.name}},DeviceType,@{name=”Device”;expression={$_.DeviceUserAgent.ToString().Split(“/”)[0]}},@{name=”OSVersion”;expression={$_.DeviceUserAgent.ToString().Split(“/”)[1]}},LastSuccessSync}
to
$Resultset = foreach($mbx in get-mailbox) {Get-ActiveSyncDeviceStatistics -Mailbox:$mbx.Identity -ShowRecoveryPassword:$true |Select-Object @{name=”Username”;expression={$mbx.name}},DeviceType,@{name=”Device”;expression={$_.DeviceUserAgent.ToString().Split(“/”)[0]}},@{name=”OSVersion”;expression={$_.DeviceUserAgent.ToString().Split(“/”)[1]}},LastSuccessSync}
and
$Object = “” | Select-Object Username,DeviceType,Device,Version,LastSuccessSync
to
$Object = “” | Select-Object Username,DeviceType,Device,Version,LastSuccessSync,RecoveryPassword
let me know how that works
Thanks
Dean