12

I'm looking for an Exchange 2010 command that would do the following:

  1. Given an email address (fully-qualified with domain and all) check if the email address is associated to some mailbox or group in the system;
  2. (Ideally) show which entity owns that email address

This would be very helpful for me to check my migration and make sure all of our aliases were moved correctly.

tacos_tacos_tacos
  • 3,220
  • 16
  • 58
  • 97

5 Answers5

15

Get-Recipient -Identity user@domain.com

This will return the recipient object for whoever has the given email address (including aliases). Since emails are guaranteed to be unique this should never return more than one record (I believe).

Get-Recipient -ANR user

You can use -ANR to search using Ambiguous Name Resolution (so you can type their first, last, username, etc), but while ANR will match a user's primary email address, it will not match their other SMTP aliases. ANR can return multiple matches (so ensure your code handles this case).

Get-Mailbox is not sufficient to confirm that an email address is unique, as it will not necessarily return contacts, or records from external or legacy systems. It returns mailboxes... and while all mailboxes have an email address, not all email addresses are a mailbox.

Myrddin Emrys
  • 638
  • 1
  • 10
  • 24
  • This doesnt bring back any aliases of a mailbox – Brian Mitchell Jan 28 '13 at 13:19
  • 1
    This is the answer that worked for me. It correctly returned the matching recipients both when searching by primary SMTP email addresses and also when searching with secondary SMTP email addresses. – RSW Mar 13 '15 at 19:10
  • 2
    @BrianMitchell, It totally can, if piped to view the desired attributes. `Get-Recipient user@domain.com | Select Name,EmailAddresses`. By default, it will just show `Name` and `RecipientType`. – blaughw Jan 28 '16 at 18:16
3

This should do the trick:

get-mailbox -an user@domain.com 
Mikael Grönfelt
  • 627
  • 3
  • 7
  • 14
  • 5
    This will not work for accounts with multiple SMTP aliases; only the primary email address will return a record. Aliases will return nothing (falsely indicating the account is available). – Myrddin Emrys Mar 29 '12 at 21:49
  • 3
    Does not work for secondary addresses on a mailbox. –  May 23 '13 at 10:59
2

I realize this is a bit old, but just solved the issue by running the following:

Get-Mailbox | %{$_.EmailAddresses | ?{$_ -like "*<email address>*"}}
Get-DistributionGroup | %{$_.EmailAddresses | ?{$_ -like "*<email address>*"}}
Get-MailPublicFolder | %{$_.EmailAddresses | ?{$_ -like "*<email address>*"}}

If anything was returned by any of them, it wouldn't necessarily tell me WHAT account was using it, but, I could then focus on which of the three returned a record to dive deeper. If nothing is returned, then it's not being used.

1

The following worked for me, even with aliases:

get-recipient -filter {emailaddresses -like "*user@domain.com*"}

Also returns the name of the recipient and the type.

Travis V.
  • 31
  • 3
  • Not sure why this was downvoted, but it also worked for me. I had to first set the AD Server Settings to view the entire forest with: Set-ADServerSettings -ViewEntireForest $true – Alex Hague Apr 16 '20 at 07:09
  • Confirmed, this actually works. – Ronald May 25 '20 at 12:38
  • works for me as well, I used this to search for emails that contained the word "volunteer" for example to see which accounts to follow up on. – NBN-Alex May 10 '21 at 22:51
0

Get-Recipient should do the trick