Thanks Robbie, doesn't seem to work as I get an error saying that the
property isnt in the cache. I will keep trying here though :) 

-----Original Message-----
From: Robbie Allen [mailto:[EMAIL PROTECTED] 
Sent: 05 December 2003 16:13
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] [Slightly OT] OU of a user in AD

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
http://www.rallenhome.com/


________________________________

        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 AD
        
        

        Does 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


List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to