No announcement yet.

add 2nd SMTP address in bulk, possible?

  • Filter
  • Time
  • Show
Clear All
new posts

  • add 2nd SMTP address in bulk, possible?

    I have been reading about ADModify tool. Can it mass-add a secondary SMTP address to all users within our organization & make it the "primary address"? If not, any ideas on how we can get this done?

    Much appreciated.
    Last edited by pacini; 26th June 2007, 10:50.

  • #2
    Re: add 2nd SMTP address in bulk, possible?

    You need a textfile containing the Usernames plus the new Emailaddress. That is the only way you can match the correct user with its new email address.

    If you use a vbscript, keep in mind that the primary address of an object must start with uppercase SMTP: and all secondondaries starts with lowercase smtp:
    And there can only be one Primaryaddress! so before adding a new primary change the current primary first to a secondary.

    'Add an e-mail and make it the primary e-mail address
        Dim objRecip
        Dim mycontact' As ContactItem
        Dim proxies
        'On Error Resume Next
        Set oUser = GetObject ("LDAP://CN=Buffy Summers,OU=Scoobies,DC=sunnydale,DC=muni")
        Set objRecip = oUser
        sAddress = "SMTP:[email protected]"
           bIsFound = False
           vProxyAddresses = objRecip.ProxyAddresses
           nProxyAddresses = UBound(vProxyAddresses)
           i = 0
           Do While i <= nProxyAddresses
              email = vProxyAddresses(i)
              If Left (email,5) = "SMTP:" Then 
                    vProxyAddresses (i) = "smtp:" & Mid (email,6)
              End If       
              If vProxyAddresses(i) = sAddress  Then
                 bIsFound = True
                    Exit Do
              End If
              i = i + 1
           If Not bIsFound Then
               ReDim Preserve vProxyAddresses(nProxyAddresses + 1)
               vProxyAddresses(nProxyAddresses + 1) = sAddress
               objRecip.ProxyAddresses = vProxyAddresses
           End If
    It is a start.
    The next thing to do is to change the beginning of the script so it can read the lines of a text-file containing the user names and emailaddresses, create a loop to process line by line.


    This posting is provided "AS IS" with no warranties, and confers no rights.


    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts