User email account validation

This topic contains 6 replies, has 4 voices, and was last updated by  notarat 4 years, 7 months ago.

  • Author
  • #10530


    Hi Experts,

    in my organisation we have email address is stored in one of the extension attributes in user accounts. Now is there any way to validate whether that email id is correct using AD powershell?

  • #10532

    Dave Wyatt

    You can certainly access those AD attributes. If your script has a way of knowing what a user's email address is supposed to be, then you can check for the correct value, or even update it if it's wrong. The command will look something like this, assuming you're using the ActiveDirectory module:

    $user = Get-ADUser -Identity SomeDude -Properties extensionAttribute6
  • #10534


    Hi Dave,

    Sorry if my question is not clear to you...

    Your code will give me the Email ID present in extensionattribute6. But sometimes this email id might have expired or this might not get resolve in outloook because there was some spelling mistake while updating email address in this extensionattribute6.

    lets take an example.. In our org for service accounts we will update email id of the service account owner in Service Account properties(lets say extensionattribute6).. there are chances that this owner left the company and email id is not valid anymore. Now how can i find such accounts whose owner is not valid (ie extensionattribute6 is not getting resolved in outlook).

  • #10535

    Richard Siddaway

    This will find a mailbox based on the attribute value

    $mbx = Get-Mailbox -Identity (Get-ADUser -Identity SomeDude -Properties extensionAttribute6 -erroraction silentlycontinue | select -expand extensionAttribute6)
    if ($mbx) { do stuff as it exists}
    else { do other stuff because it doesn't exist

  • #10718


    get-mailbox is exchange cmdlet.. how can i get result using AD cmdlets?

  • #10807


    hi guys...any inputs?

  • #10861


    You're trying to compare what is in AD to what is in Exchange, in order to see if the entry in AD is wrong. So, you need to load the AD module and the exchange module so you can access both the extended attribute in AD (where the email address is) and exchange where the "proper" email address is located. At least that's how it sounds to me.

    I'd throw together a script that compares the AD extended attribute to the exchange attribute but I do not have access to the Exchange cmdlets in my organization since it's a different team handling mail servers. sorry

You must be logged in to reply to this topic.