Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing poperties in Active Directory

Status
Not open for further replies.

dupuis2387

Programmer
Sep 25, 2006
9
US
Public Function MyScript(Name As Variant)

Dim dommail1ldap As Variant
Dim ActiveDirectory1 As Variant
Dim ADUsername As Variant
Dim Email As Variant
Dim WScript As Variant
Set dommail1ldap = GetObject("LDAP://domainame/O=Flagella")
Set ActiveDirectory1 = GetObject("LDAP://server/CN=user,DC=Flagella,DC=flx")

For Each Name In ActiveDirectory1
ADUsername = Name.sAMAccountName
If Name.mail = "" Then
For Each Email In dommail1ldap
If Name.sAMAccountName = Email.uid Then
WScript.Echo Email.mail
Name.Put "mail", Email.mail
Name.Setinfo
Exit For
End If
Next
Else
WScript.Echo "Email Address for " & Name.cn & " is " & Name.mail
End If
Next
End Function


What am I doing wrong? Need I import certain "system."? add some refrences?

thanks for any help.
 
Well. First, this is vb scripting, not vb6, so you may be in the wrong forum. Next, you don't say anything about what isn't working for you. You might try reposting in the scripting forum, and explain what sort of behavior you're getting that you'd rather not get.

HTH

Bob
 
err, makes sense. sorry. I'll try the scripting forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top