ADSI object attributes

Given something like,

Set objRootDSE = GetObject("LDAP://RootDSE")

How can I find the attributes of this object?
DaveChoiceTechAsked:
Who is Participating?
 
JesterTooConnect With a Mentor Commented:
I believe the rationale is:

Because an AD forest can contain multiple domains, the dsservicename property needs to be bound to a domain before it can be retrieved.  The removed statement provides a "default" binding to the domain in which the "directory services" server has been defined.  Without that statement the dsservicename property was not found to any domain.

There are probably more formal ways to achieve the domain binding that are more intuitive, but info. regarding many aspects of the intricacies of ADSI are difficult to come by out on the web.  If you find yourself doing very much with ADSI then a good book on the topic will make the tasks easier.  There are several titles available and can be easily found by googling for:  book ADSI.

HTH,
Lynn
0
 
beryl666Connect With a Mentor Commented:
Reading the objectClassCategory Attribute of Several Classes
arrClassNames = Array _
 ("cn=top","cn=mail-Recipient", "cn=security-Principal", _
 "cn=person", "cn=Organizational-Person", _
 "cn=contact", "cn=user", "cn=computer", "cn=organizational-Unit")
 
Set objRootDSE = GetObject("LDAP://rootDSE")
For Each ClassName in arrClassNames
 Set objSchemaClass = GetObject("LDAP://" & ClassName & "," & _
 objRootDSE.Get("schemaNamingContext"))

 intClassCategory = objSchemaClass.Get("objectClassCategory")
 WScript.STDOUT.Write ClassName & " is "
 Select Case intClassCategory
 Case 0
 Wscript.Echo "88"
 Case 1
 Wscript.Echo "structural"
 Case 2
 Wscript.Echo "abstract"
 Case 3
 Wscript.Echo "auxiliary"
 End Select
Next

refer this to understand more:
http://www.asia.microsoft.com/technet/scriptcenter/guide/sas_ads_ftdm.mspx
0
 
gecko_au2003Connect With a Mentor Commented:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/accessing_attributes_with_adsi.asp

There is a url that microsoft provides, if you look to the left it has related topics on Get and GetEx and such like. I hope that helps you out :)
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
DaveChoiceTechAuthor Commented:
Thanks for both answers. Give me a chance to review them and I'll settle up the points but first here is some background for the reason I was asking the original question.

This scriptlet works

set odomain = getobject("LDAP://RootDSE")
wscript.echo odomain.dnshostname
wscript.echo odomain.dsservicename

however this doesn't

set odomain = getobject("LDAP://RootDSE")
wscript.echo odomain.dsservicename

Only one line was removed! What is going on?

0
 
DaveChoiceTechAuthor Commented:
Lynn,

That sounds good but may not be the answer since I found that using "Get" as shown below works fine. My guess is that there is something going on with caching and timing. Seems that working with attributes in Vbscript is kinda of buggy. I don't want to flog this to death but I'll leave the question open for a day or two since I always like to here expert opions such as you have offered. I appreciate you help.

Thanks,
Dave


set odomain = getobject("LDAP://RootDSE")
'wscript.echo odomain.dnshostname
'wscript.echo odomain.dsservicename
strfoo = odomain.Get("dsServicename")
WScript.Echo strfoo

0
 
JesterTooCommented:
You may be correct, Dave.

Actually, I don't think VBScript is "at fault" here... it's more likely to be anomalies within ADSI itself.  My guess (no docs seem to cover the internal workings in any detail) is that with the "more formalized" GET method that there is an internal method call to retrieve the default naming context property and that without the GET, it is relying on that property to have already been established by some other means.  If true, this would seem to be a bit "sloppy" to me so I guess the lesson of the story is to try to use only established/documented protocols for setting/retrieving properties.

I, too, will be interested to hear others' opinions on this :-)

Regards,
Lynn
0
 
gecko_au2003Commented:
You talk about Get but there is no mention of GetEx as stated in the documenation, is there any difference between Get and GetEx ?
0
 
gecko_au2003Commented:
I mean in terms of speed or the ability to get the information without any bugs as you stated.
0
 
JesterTooCommented:
The "Get" method is used to return the value of a property which can have at most 1 value.  "GetEx" is used to return values from properties which can have multiple values... it can also be used in place of Get for single-valued properties.

Both of those methods implicitly call the GetInfo method.

Here is a pretty good article describing, in part, what I was referring to above about ADSI being somewhat inconsistent in how you can access the various properties...  http://www.windowsitpro.com/Article/ArticleID/4991/4991.html

Here's one key excerpt from that article...

Unlike the six core properties, not all object properties have explicit property methods that you can use to retrieve properties. However, you can implicitly access an object's property by treating the property as the method in automation languages, such as VBScript, JScript, and Visual Basic (VB). In nonautomation languages, such as Visual C++ (VC++), you must use the IADs Get method for any property that doesn't have an explicit property method. You need to check the ADSI documentation to determine whether property methods exist. (For more information about where you can find the ADSI documentation, see "An ADSI Primer, Part 1," January 1999.)

This article is part 3 of a 12-part series on ADSI.

All in all, I'm grateful for the existence of ADSI.  But, it seems to have been designed/constructed by committee without much thought towards a consistent interface.

-- Lynn
0
 
jangeadorCommented:
There is a tool that I use to determine wether I should use Get or GetEx. This tool is called ADSIEdit.msc, and it lets me browse through all the properties and objects in the AD schema.

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=49ae8576-9bb9-4126-9761-ba8011fabf38

jangeador
0
 
DaveChoiceTechAuthor Commented:
There was no "answer" to the original question but everyones comments were helpful. Accordingly I have split the points.
Cheers,
Dave
0
 
gecko_au2003Commented:
Than Q Dave for the grade and points.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.