Announcement

Collapse
No announcement yet.

Autofilling email address in AD

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Autofilling email address in AD

    Hi,

    We have been asked at work by auditors to ensure that all users in AD have the email address field filled. On running a query we have found that about 400/500 people have not the email address filled in.

    Is it possible to run a script or run something in AD to automatically fill all users email address field. We use Lotus Notes so unfortunately we don't use Exchange.

    Any help is greatly appreciated.

    Thanks!

  • #2
    Re: Autofilling email address in AD

    Hey there,

    this all depends on what your email address naming convention is.
    is it something like [email protected] ?
    as long as its consistant a script for this is pretty easy.
    as the email is just a AD field, you could do this with powershell or a simple script.

    Comment


    • #3
      Re: Autofilling email address in AD

      You can use ADModify to make bulk changes to users.

      http://admodify.codeplex.com/Release...ReleaseId=6065

      Comment


      • #4
        Re: Autofilling email address in AD

        Hi Guys,

        Apologies for the late reply, i was out of work last week. Appreciate the comments. I have created the below scriptfrom one i found online but have been unsuccessful in running it due to some errors coming up. I'm no programmer or script writer so having trouble deciphering the problem. Also, in answer to your question joshsaunders, yes it is consistent, it's [email protected].

        On Error Resume Next

        Const ADS_SCOPE_SUBTREE = 2
        Set objConnection = CreateObject("ADODB.Connection")
        Set objCommand = CreateObject("ADODB.Command")
        objConnection.Provider = "ADsDSOObject"
        objConnection.Open "Active Directory Provider"
        Set objCommand.ActiveConnection = objConnection
        objCommand.Properties("Page Size") = 1000
        objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
        objCommand.CommandText = _
        "SELECT AdsPath,givenName,userPrincipalName FROM " & _
        "'LDAP://OU=TestOU,dc=AP,dc=com' WHERE objectCategory='user'"
        objCommand.CommandText = _
        "SELECT AdsPath,sn,userPrincipalName FROM " & _
        "'LDAP://OU=TestOU,dc=AP,dc=com' WHERE objectCategory='user'"
        Set objRecordSet = objCommand.Execute
        objRecordSet.MoveFirst
        Do Until objRecordSet.EOF
        strUser = objRecordSet.Fields("ADsPath").Value
        strNewUPN = objRecordSet.Fields("givenName").Value & "_" & objRecordSet.Fields("sn").Value & "@" & "companyX.com.au"
        Set objUser = GetObject(strUser)
        objUser.Mail = strNewUPN
        objUser.SetInfo
        objRecordSet.MoveNext
        Loop


        Thanks again Guys for any help given

        Kind Regards

        Comment

        Working...
        X