Table of Contents
Use the DistinguishedName!
I bet an awful lot of Exchange admins have encountered this error in PowerShell:
The operation couldn’t be performed because ” matches multiple entries.
I got the error using the Get-MailboxRestoreRequest cmdlet, but it doesn’t matter which cmdlet you were using for the solution.
The problem often is a guestuser or a SoftDeletedMailbox.
How can I solve this?
Use the DistinguishedName.
The DistinguishedName is always different and all recipients have this property.
You can use one of these cmdlets to find the correct entry:
Get-Mailbox -Identity 'multiple entries' | Select-Object DistinguishedName
Get-Recipient 'multiple entries' | Select-Object DistinguishedName
Usually when it’s only 2 entries I use something like the cmdlet below.
Change -First ‘1’ to any line the correct entry is and change Get-Mailbox to whatever cmdlet you were using.
$User = Get-Recipient 'multiple entries' | Select-Object DistinguishedName -First 1 Get-Mailbox -Identity $User.DistinguishedName
How can something like this happen?
That’s a good question to which I don’t have an immediate answer, but I do have a few suggestions.
You do not get this message when you run a Get-Mailbox, you will only see this message when you run Get-Recipient. My guess is that when you for example add a user to a group it will use Get-Recipient in the backend, and find multiple entries under the name, UserPrincipalName… and throws this error.