Exchange 2010 remove mobile device Error The ActiveSyncDevice Cannot be Found

This post is also available in: Polish

When you are trying to remove or wipe mobile device connected to mailbox, you can get error like below:

The ActiveSyncDevice Cannot be Found

You will get this error when you are trying to remove mobile device which were connected to user mailbox, and after user account was moved to other OU in Active Directory.

It’s caused because EMC can’t find “path” to old mobile device.

You can easly check this using two powershell commands:
Get-ActiveSyncDevice
Get-ActiveSyncDeviceStatistics
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 admin@domain.com

 

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
 }
}

 

Print Friendly
Tagged , , , , , , , . Bookmark the permalink.

6 Responses to Exchange 2010 remove mobile device Error The ActiveSyncDevice Cannot be Found

  1. GiSo says:

    Hi Remigiusz and thanks for you article but I obtain this error if I use your cmdlet:

    Cannot bind argument to parameter 'Identity' because it is null.
    + CategoryInfo : InvalidData: (:) [Remove-MobileDevice], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Remove-MobileDevice

    Can You help me?

    • Remigiusz Szatkowski says:

      Hi
      can you tell me which cmdlet you are using ?
      I think you have tried to remove mobile device using this:
      Remove-ActiveSyncDevice -Identity $(Get-ActiveSyncDevice -Mailbox JSmith | where {$_.DeviceId -like “androidc1640524549″} | select Identity).identity

      and then you can get error because sometimes when user was moved between OUs in AD you can’t remove mobile devices.
      Then you need to find correct mobile device identity. I wrote about this at the bottom of this article. Try to run last script for mailbox where you get error, and then check idenity and use correct identity in remove-activesyncdevice

  2. GiSo says:

    Hi Remigiusz,
    Yes, i’ve used Remove-ActiveSyncDevice -Identity $(Get-ActiveSyncDevice -Mailbox JSmith | where {$_.DeviceId -like “androidc1640524549″} | select Identity).identity and i have obtained the error.

    If i use your script at the bottom of the article i obtain a new error:
    Avvio di un comando nel server remoto non riuscito con il seguente messaggio di errore: [ClientAccessServer=AMXPR07CA00
    1,BackEndServer=dbxpr07mb445.eurprd07.prod.outlook.com,RequestId=54149117-77e3-434f-bdb5-f28b364a13ab,TimeStamp=5/5/201
    4 7:01:28 AM] [FailureCategory=WSMan-InvalidShellID] The request for the Windows Remote Shell with ShellId 0DB7F944-489
    B-4679-B891-55D82CE4E96B failed because the shell was not found on the server. Possible causes are: the specified Shell
    Id is incorrect or the shell no longer exists on the server. Provide the correct ShellId or create a new shell and retr
    y the operation.
    + CategoryInfo : OperationStopped: (System.Manageme...pressionSyncJob:PSInvokeExpressionSyncJob) [], PSRe
    motingTransportException
    + FullyQualifiedErrorId : JobFailure

  3. GiSo says:

    We use Office 365 / Exchange 2013 Online.

  4. Rosario says:

    Thanks a lot, we indeed have a lot of movements in the Active Directory OUs so I combined your two methods in one ps-script and it worked like a charm.

Leave a Reply to Rosario Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>