Accessing OU attributes and User attributes

Accessing OU attributes and User attributes

Post by Fred Gour » Fri, 18 Oct 2002 10:47:06



I need help in getting OU attributes and User Attributes
in a single pass.  What I am looking to do is write out a
file that contains the OU name and the sAMAccountName
from the user class.

Does anyone have any suggestions?

Thanks in Advance,
Fred

 
 
 

Accessing OU attributes and User attributes

Post by Marc Scheune » Fri, 18 Oct 2002 22:18:54


On Wed, 16 Oct 2002 18:47:06 -0700, "Fred Goure"


>I need help in getting OU attributes and User Attributes
>in a single pass.  What I am looking to do is write out a
>file that contains the OU name and the sAMAccountName
>from the user class.
>Does anyone have any suggestions?

a) Bind to the OU by calling ADsGetObject and getting an IADsContainer
interface for the OU
b) What is it you're trying to get from the OU ??

c) Bind to each user in the OU (enumerate the users in the OU)
d) For each user, get its SAMaccountName and output that to a file

I don't quite understand what you mean by "in a single pass" - you
will have to bind to both the OU and each of the users in the OU to
get the info.

Alternatively, you could try to do a search in the OU using the ADO
provider for ADSI to get just the attributes you want.

Marc