dupuis2387
Programmer
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.
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.