Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - ADSI and Searching Indexed Attributes

Reply
 
Old 12-11-2008   #1 (permalink)
Larry


 
 

ADSI and Searching Indexed Attributes

I'm reading the Microsoft Windows 2000 Scripting Guide so I can learn to
script. Multiple times it says to optimize your search, use indexed criteria
and naturally these same references are made on the MSDN site.

I understand why I'd want to search indexed entries but it makes it sound
like I have a choice. For example, if I need to search AD for all objects
with an attribute value of "Windows Server*", aren't I only going to get this
from one attribute, "operatingSystem"? Either that attribute is indexed or
it's not (I don't know off hand). It's not like I can search another
attribute that IS indexed that'll have that same information - or is there? I
certainly didn't see one in ADSI Edit. I really don't see any information
that is duplicated in another attribute.

This advice really doesn't seem helpful unless I have the authority to
change the schema and index an attribute - perhaps that's the point.

My System SpecsSystem Spec
Old 12-11-2008   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: ADSI and Searching Indexed Attributes

Larry wrote:
Quote:

> I'm reading the Microsoft Windows 2000 Scripting Guide so I can learn to
> script. Multiple times it says to optimize your search, use indexed
> criteria
> and naturally these same references are made on the MSDN site.
>
> I understand why I'd want to search indexed entries but it makes it sound
> like I have a choice. For example, if I need to search AD for all objects
> with an attribute value of "Windows Server*", aren't I only going to get
> this
> from one attribute, "operatingSystem"? Either that attribute is indexed or
> it's not (I don't know off hand). It's not like I can search another
> attribute that IS indexed that'll have that same information - or is
> there? I
> certainly didn't see one in ADSI Edit. I really don't see any information
> that is duplicated in another attribute.
>
> This advice really doesn't seem helpful unless I have the authority to
> change the schema and index an attribute - perhaps that's the point.
You are correct that you usually have no choice. The operatingSystem
attribute is not indexed. The most common example where it matters is
objectCategory vs. objectClass. The former is indexed, the latter is not.

The systemFlags property of attribute objects (in the Schema container of
AD) indicates if the attribute is indexed (among other settings). The
systemFlags property is a flag attribute where you use a bit mask to tell if
the appropriate bit is set (similar to userAccountControl). Several bit
masks are used with this property. Unfortunately, this generally makes it
difficult to tell which bits are set. A VBScript example to tell if a
specific attribute is indexed would be as follows:
==========
Const IS_INDEXED = 1

Set objAttribute =
GetObject("LDAP://cn=Operating-System,cn=Schema,cn=Configuration,dc=MyDomain,dc=com")
intSysFlags = objAttribute.systemFlags
If ((intSysFlags And IS_INDEXED) <> 0) Then
Wscript.Echo "The attribute is indexed"
Else
Wscript.Echo "The attribute is NOT indexed"
End If
==========
In this case, because the bit mask is 1, any odd value for systemFlags means
the attribute is indexed. Any even value means the attribute is NOT indexed.
The value of systemFlags for the Operating-System attribute is 16. You can
view this with ADSI Edit or ldp in the Schema container of the Configuration
container of your AD.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 12-11-2008   #3 (permalink)
Larry


 
 

Re: ADSI and Searching Indexed Attributes

Thanks for the confirmation.

"Richard Mueller [MVP]" wrote:
Quote:

> Larry wrote:
>
Quote:

> > I'm reading the Microsoft Windows 2000 Scripting Guide so I can learn to
> > script. Multiple times it says to optimize your search, use indexed
> > criteria
> > and naturally these same references are made on the MSDN site.
> >
> > I understand why I'd want to search indexed entries but it makes it sound
> > like I have a choice. For example, if I need to search AD for all objects
> > with an attribute value of "Windows Server*", aren't I only going to get
> > this
> > from one attribute, "operatingSystem"? Either that attribute is indexed or
> > it's not (I don't know off hand). It's not like I can search another
> > attribute that IS indexed that'll have that same information - or is
> > there? I
> > certainly didn't see one in ADSI Edit. I really don't see any information
> > that is duplicated in another attribute.
> >
> > This advice really doesn't seem helpful unless I have the authority to
> > change the schema and index an attribute - perhaps that's the point.
>
> You are correct that you usually have no choice. The operatingSystem
> attribute is not indexed. The most common example where it matters is
> objectCategory vs. objectClass. The former is indexed, the latter is not.
>
> The systemFlags property of attribute objects (in the Schema container of
> AD) indicates if the attribute is indexed (among other settings). The
> systemFlags property is a flag attribute where you use a bit mask to tell if
> the appropriate bit is set (similar to userAccountControl). Several bit
> masks are used with this property. Unfortunately, this generally makes it
> difficult to tell which bits are set. A VBScript example to tell if a
> specific attribute is indexed would be as follows:
> ==========
> Const IS_INDEXED = 1
>
> Set objAttribute =
> GetObject("LDAP://cn=Operating-System,cn=Schema,cn=Configuration,dc=MyDomain,dc=com")
> intSysFlags = objAttribute.systemFlags
> If ((intSysFlags And IS_INDEXED) <> 0) Then
> Wscript.Echo "The attribute is indexed"
> Else
> Wscript.Echo "The attribute is NOT indexed"
> End If
> ==========
> In this case, because the bit mask is 1, any odd value for systemFlags means
> the attribute is indexed. Any even value means the attribute is NOT indexed.
> The value of systemFlags for the Operating-System attribute is 16. You can
> view this with ADSI Edit or ldp in the Schema container of the Configuration
> container of your AD.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
ADSI attributes Case Sensitve PowerShell
Searching for files by attributes Vista file management
disabling non-indexed searching in instant search Vista file management
Searching within non-indexed files. Vista General
Searching within non-indexed files. Vista file management


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46