Post by Davez2I've written a vbscript that lists the group membership of a user.
Each group is displayed with its parent directorys canonical name.
How can I detect and show the canonicalName of the domain users group?
The canonicalName attribute is operational (also known as a constructed
attribute). The value is not saved in Active Directory, but calculated on
request. Use the GetInfoEx method of the group object to do this. This
attribute is also multi-valued. Your code needs to handle the situation
where there is no canonical name, one name, or more than one. I use code
similar to:
==========
Set objGroup = GetObject("LDAP://cn=Domain
Users,cn=Users,dc=MyDomain,dc=com")
objGroup.GetInfoEx Array("canonicalName"), 0
arrNames = objGroup.Get("canonicalName")
If (TypeName(arrNames) = "String") Then
Wscript.Echo arrNames
ElseIf Not IsEmpty(arrNames) Then
For k = 0 To UBound(arrNames)
Wscript.Echo arrName(k)
Next
Else
Wscript.Echo "<no canonical name>"
End If
=======
As far as I know, objects always have one canonicalName, never zero or more
than one. Still, since the attribute is multi-valued, I'd rather not take a
chance.
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab web site - http://www.rlmueller.net
--