An Array Of Attributes
Don Jones at MCPmag writes:
Simple attributes are old school; do more with multi-valued attributes in your scripts.
Ready for your Scripting Answers? This time, let me show you how to work with the complex, multi-valued attributes in Active Directory. Unlike nice, simple attributes like name, which contains one and only one value for each user, multi-valued attributes act like arrays, and can contain multiple values. Let’s take the otherHomePhone property as an example. Reading its values works like this:
Set objUser = GetObject _
(”LDAP://cn=donj,ou=Legal, dc=company,dc=com”)
strOtherPhone = objUser.GetEx(”otherHomePhone”)
For Each strValue In strOtherPhone
WScript.Echo strValue
Next
Notice the use of GetEx(), which returns an array of values that the For Each loop walks through one at a time. Need to add a new phone number? Do so as follows:
Const ADS_PROPERTY_APPEND = 3
Set objUser = GetObject _
(”LDAP://cn=donj,ou=Legal, dc=company,dc=com”)
objUser.PutEx ADS_PROPERTY_APPEND, _
“otherHomePhone”, Array(”(123) 555-1212″)
objUser.SetInfo
[Continue reading An Array Of Attributes]

© 1996-2006, Lockergnome LLC. ISSN: 1095-3965. All Rights Reserved. Please read our