Link to home
Start Free TrialLog in
Avatar of juragan
juragan

asked on

Adding Proxy Addresses in Exchange 2003 by script

I need to add additional proxy-addresses to a bunch ofl users via a script.
The user list is available in a CSV file with the following format:

                                         primarysmtp@domain1.com, proxyaddress@domain2.com

No 'samAccount' or 'ADSpath' attributes there.

How do you find the ADSpath of the user, given only his primary SMTP e-mail address?  You need the ADSpath in order to append the new secondary smtp address, don't you?

Would appreciate if anyone can assist me with the script.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of juragan
juragan

ASKER

Hi Chris,

Thanks for the script. I just came back from a trip, so I'll let you know soon how it is going :)

- J -
Avatar of juragan

ASKER

The script works great!  Thanks!

You're welcome. Have a good christmas :)

Chris
Avatar of juragan

ASKER

Merry Christmas! :)
If I I wanted to run this against an OU, I can replace the LDAP://RootDSE with LDAP://ou=Finance,dc=fabrikam,dc=com, right?

Not quite, no.

You would need to modify these lines:

Set objRootDSE = GetObject("LDAP://RootDSE")
objCommand.CommandText = "SELECT aDSPath, mail " &_
      "FROM 'LDAP://" & objRootDSE.Get("defaultNamingContext") & "' WHERE objectClass='user'"
Set objRootDSE = Nothing

All RootDSE does for us is find the "DC=fabrikam,DC=com" portion of the domain without us having to write it. In your case you want to change the CommandText to this:

objCommand.CommandText = "SELECT aDSPath, mail " &_
      "FROM 'LDAP://ou=Finance,dc=fabrikam,dc=com' WHERE objectClass='user'"

That is used as the base for the search, the connection point. Because we set ADS_SCOPE_SUBTREE it will go from that point to any child OU.

Chris