If you want to get the RDN (e.g. cn=Users), use
this:
GetObject(objUser.Parent).Name
If you want to get just the name of the parent (e.g.
Users), use this:
GetObject(objUser.Parent).Get("name")
This isn't the most efficient way to do things if you are
going to iterate over a bunch of users. You'd be better off parsing the
distinguished name of the user. There are some functions in IADsTools that
can help with this if you are interested in that.
Robbie Allen
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Oliver Marshall
Sent: Friday, December 05, 2003 10:49 AM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] [Slightly OT] OU of a user in ADDoes anyone know if the OU of a user can be retrieved via a script ?
I am using the following to TRY and set the description of the user to its OU (dont ask). but I cant find an OU parameter or similar that i can query.
For Each objUser in objDomain
objUser.description=objuser.ou
objUser.SetInfo
next