Discussion:
How do I find and display the canonicalName of the domain users group?
(too old to reply)
Davez2
2007-02-18 18:31:41 UTC
Permalink
I'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?
Richard Mueller [MVP]
2007-02-18 19:56:01 UTC
Permalink
Post by Davez2
I'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
--
Davez2
2007-02-19 15:25:29 UTC
Permalink
Post by Richard Mueller [MVP]
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.
Thanks for the help


I use a very haphazard method for scripting. Running into problems and
searching the internet and or posting to newsgroups to find solutions.
Which is great but a little slow, and labor intensive for someone
else.
Where do you go to find out information like you've included above.
Post by Richard Mueller [MVP]
From a scripting book?
Or somekind of on line SDK library?
Richard Mueller [MVP]
2007-02-20 19:26:51 UTC
Permalink
Post by Davez2
Post by Richard Mueller [MVP]
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.
Thanks for the help
I use a very haphazard method for scripting. Running into problems and
searching the internet and or posting to newsgroups to find solutions.
Which is great but a little slow, and labor intensive for someone
else.
Where do you go to find out information like you've included above.
Post by Richard Mueller [MVP]
From a scripting book?
Or somekind of on line SDK library?
The best resource for scripting tasks in Active Directory is "Microsoft
Windows 2000 Scripting Guide". I like the text, but it is also available
online at:

http://www.microsoft.com/technet/scriptcenter/guide/sagsas_overview.mspx?mfr=true

In this case the guide gives clues, but putting it all together required
experimentation a few years ago. Sometimes the best place to get answers is
in the newsgroups.
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab web site - http://www.rlmueller.net
--
Loading...