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: Making an Explicit Call to GetInfoEx and Enumerating Results

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


 
 

ADSI: Making an Explicit Call to GetInfoEx and Enumerating Results

"Rather than download most attributes of an object, you can selectively load
or refresh the local property cache with a specific attribute or set of
attributes by using the GetInfoEx method."

Desired output, the actual Active Directory values for the attributes in the
array.

CODE:
Set objUser = GetObject _
("LDAP://cn=TestUser, ou=Users, OU=Sbd, dc=us, dc=Fabrikam, dc=com")
arrAttributes = Array("description", "name")
objUser.GetInfoEx arrAttributes, 0
For Each Attribute In arrAttributes
WScript.Echo Attribute
Next

EXPECTED OUTPUT:
Account used for testing.
TestUser

ACTUAL OUTPUT:
description
name

====================
What am I misunderstanding? The array shouldn't actually be composed of the
strings "description" and "name" but the returned values of those AD
attributes.


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


 
 

Re: Making an Explicit Call to GetInfoEx and Enumerating Results


"Larry" <Larry@xxxxxx> wrote in message
news:74A40BA2-7F23-4CA9-B6D9-7D722E99F89E@xxxxxx
Quote:

> "Rather than download most attributes of an object, you can selectively
> load
> or refresh the local property cache with a specific attribute or set of
> attributes by using the GetInfoEx method."
>
> Desired output, the actual Active Directory values for the attributes in
> the
> array.
>
> CODE:
> Set objUser = GetObject _
> ("LDAP://cn=TestUser, ou=Users, OU=Sbd, dc=us, dc=Fabrikam, dc=com")
> arrAttributes = Array("description", "name")
> objUser.GetInfoEx arrAttributes, 0
> For Each Attribute In arrAttributes
> WScript.Echo Attribute
> Next
>
> EXPECTED OUTPUT:
> Account used for testing.
> TestUser
>
> ACTUAL OUTPUT:
> description
> name
>
> ====================
> What am I misunderstanding? The array shouldn't actually be composed of
> the
> strings "description" and "name" but the returned values of those AD
> attributes.
>
The array itself is unchanged by the GetInfoEx method. Instead, all values
are cached. You then can use the Get method to retrieve the values. For
example:
=======
Set objUser = GetObject _
("LDAP://cn=TestUser, ou=Users, OU=Sbd, dc=us, dc=Fabrikam, dc=com")
arrAttributes = Array("description", "name")
objUser.GetInfoEx arrAttributes, 0

For Each Attribute In arrAttributes
WScript.Echo objUser.Get("Attribute")
Next
========
The main reason I am aware of to use the GetInfoEx method is to retrieve the
value of operational attributes (also called constructed). The GetInfoEx
method forces AD to calculate the values.

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


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


 
 

Re: Making an Explicit Call to GetInfoEx and Enumerating Results


"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
message news:utsLPVuWJHA.5064@xxxxxx
Quote:

>
> "Larry" <Larry@xxxxxx> wrote in message
> news:74A40BA2-7F23-4CA9-B6D9-7D722E99F89E@xxxxxx
Quote:

>> "Rather than download most attributes of an object, you can selectively
>> load
>> or refresh the local property cache with a specific attribute or set of
>> attributes by using the GetInfoEx method."
>>
>> Desired output, the actual Active Directory values for the attributes in
>> the
>> array.
>>
>> CODE:
>> Set objUser = GetObject _
>> ("LDAP://cn=TestUser, ou=Users, OU=Sbd, dc=us, dc=Fabrikam, dc=com")
>> arrAttributes = Array("description", "name")
>> objUser.GetInfoEx arrAttributes, 0
>> For Each Attribute In arrAttributes
>> WScript.Echo Attribute
>> Next
>>
>> EXPECTED OUTPUT:
>> Account used for testing.
>> TestUser
>>
>> ACTUAL OUTPUT:
>> description
>> name
>>
>> ====================
>> What am I misunderstanding? The array shouldn't actually be composed of
>> the
>> strings "description" and "name" but the returned values of those AD
>> attributes.
>>
>
> The array itself is unchanged by the GetInfoEx method. Instead, all values
> are cached. You then can use the Get method to retrieve the values. For
> example:
> =======
> Set objUser = GetObject _
> ("LDAP://cn=TestUser, ou=Users, OU=Sbd, dc=us, dc=Fabrikam, dc=com")
> arrAttributes = Array("description", "name")
> objUser.GetInfoEx arrAttributes, 0
>
> For Each Attribute In arrAttributes
> WScript.Echo objUser.Get("Attribute")
> Next
> ========
> The main reason I am aware of to use the GetInfoEx method is to retrieve
> the value of operational attributes (also called constructed). The
> GetInfoEx method forces AD to calculate the values.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
I should point out that in this case, with attributes description and name,
the GetInfoEx method is not required. It simply loads the attribute values
into the cache (local memory). The advantage is that all of the values are
retrieved at once, in one request to AD, rather than one request per
attribute. The Get method retrieves the values from the cache first, and
only requests from AD if the value is not already in the cache.

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


My System SpecsSystem Spec
Old 12-10-2008   #4 (permalink)
Larry


 
 

Re: Making an Explicit Call to GetInfoEx and Enumerating Results

Thanks for clearing that up.

"Richard Mueller [MVP]" wrote:
Quote:

>
> "Larry" <Larry@xxxxxx> wrote in message
> news:74A40BA2-7F23-4CA9-B6D9-7D722E99F89E@xxxxxx
Quote:

> > "Rather than download most attributes of an object, you can selectively
> > load
> > or refresh the local property cache with a specific attribute or set of
> > attributes by using the GetInfoEx method."
> >
> > Desired output, the actual Active Directory values for the attributes in
> > the
> > array.
> >
> > CODE:
> > Set objUser = GetObject _
> > ("LDAP://cn=TestUser, ou=Users, OU=Sbd, dc=us, dc=Fabrikam, dc=com")
> > arrAttributes = Array("description", "name")
> > objUser.GetInfoEx arrAttributes, 0
> > For Each Attribute In arrAttributes
> > WScript.Echo Attribute
> > Next
> >
> > EXPECTED OUTPUT:
> > Account used for testing.
> > TestUser
> >
> > ACTUAL OUTPUT:
> > description
> > name
> >
> > ====================
> > What am I misunderstanding? The array shouldn't actually be composed of
> > the
> > strings "description" and "name" but the returned values of those AD
> > attributes.
> >
>
> The array itself is unchanged by the GetInfoEx method. Instead, all values
> are cached. You then can use the Get method to retrieve the values. For
> example:
> =======
> Set objUser = GetObject _
> ("LDAP://cn=TestUser, ou=Users, OU=Sbd, dc=us, dc=Fabrikam, dc=com")
> arrAttributes = Array("description", "name")
> objUser.GetInfoEx arrAttributes, 0
>
> For Each Attribute In arrAttributes
> WScript.Echo objUser.Get("Attribute")
> Next
> ========
> The main reason I am aware of to use the GetInfoEx method is to retrieve the
> value of operational attributes (also called constructed). The GetInfoEx
> method forces AD to calculate the values.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Error when making video call - (0x8100039d) Live Messenger
having a problem with making a video call Live Messenger
call of duty 4....making me ill ??? Gaming
Enumerating group membership & ADSI PowerShell
RE: Option Explicit PowerShell


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