Monday, November 24, 2014

Exchange 2010 Error: The ActiveSyncDevice Cannot be Found

Recently we tried to replace a users phone and when adding his Exchange mail we got the message

"You have 10 phone partnerships out of the maximum allowed 10 partnerships. After you reach the maximum, you can't create additional partnerships until you delete existing ones from your account. To do so, sign in to Outlook Web App, click Options > Phone > Mobile Phones, and delete any unused partnerships."

However when trying to remove old devices we received the message "The ActiveSyncDevice Cannot be Found"

Thanks to this post we found our solution. Exchange 2010 remove mobile device Error The ActiveSyncDevice Cannot be Found

You can easily check this using two powershell commands:


If you run CMDlet Get-ActiveSyncDeviceStatistics for some mailbox like below:
Get-ActiveSyncDeviceStatistics -mailbox JSmith | select DeviceId, Identity
you will get:
DeviceID                 Identity
--------                 --------
androidc1640524549       domain.local/Users/Test1/Smith John/.....
androidc2040902280       domain.local/Users/Test2/Smith John/.....

next try to run CMDlet Get-ActiveSyncDevice for the same mailbox:
Get-ActiveSyncDevice -Mailbox JSmith | select DeviceId, Identity
you will get:
DeviceID                 Identity
--------                 --------
androidc1640524549       domain.local/Users/Test2/Smith John/.....
androidc2040902280       domain.local/Users/Test2/Smith John/.....
As you can see, there is difference in returned Identity between those two CMDlets.

This is bug in how Exchange detects a user object that has moved from one OU to other and does not update both identity values correctly.

To resolve this error: The ActiveSyncDevice Cannot be Found you need to compare both identity returned by Get-ActiveSyncDeviceStatistics and Get-ActiveSyncDevice.
When you will find such mobile device, you can remove it using Remove-ActiveSyncDevice and write DeviceId like below:
Remove-ActiveSyncDevice -Identity $(Get-ActiveSyncDevice -Mailbox JSmith | where {$_.DeviceId -like "androidc1640524549"} | select Identity).identity

If you want to wipe this device you need to use Clear-ActiveSyncDevice instead of Remove-ActiveSyncDevice

Also you can use -NotificationEmailAddresses to get email with information about successful wipe.
Clear-ActiveSyncDevice -Identity $(Get-ActiveSyncDevice -Mailbox JSmith | where {$_.DeviceId -like "androidc1640524549"} | select Identity).identity -NotificationEmailAddresses

If you want to check mailbox, and find all mobile devices which can cause problems with remove or wipe you can use below commands :
$name = $(Get-Mailbox JSmith).Name
$ASdevices = @(Get-ActiveSyncDevice | where {$_.UserDisplayName -like "*$name"})
foreach ($ASdevice in $ASdevices)
 $ASdevstats = Get-ActiveSyncDeviceStatistics $ASdevice

 if ($($ASdevice.Identity.ToString()) -ne $($ASdevstats.Identity.ToString())) 
  Write-Host "Wrong Identity"
  Write-Host $ASdevice.Identity
  Write-Host $ASdevstats.Identity

1 comment:

  1. Words cannot explain how grateful I am to find this. I've been trying to fix this issue for hours now. I only saw the active sync devices through powershell and it would let me remove them. So thank you for this!!