How can I determine my user account's OU in a Windows domain?

Is there any way (short of getting an active directory browser) to view my OU while logged in to the domain?


Here's a quick VBS script you can use to display your account's DistinguishedName attribute which contains the OU that your account is in:

set objSysInfo = CreateObject("ADSystemInfo")
set objUser = GetObject("LDAP://" & objSysInfo.UserName)
wscript.echo "DN: " & objUser.distinguishedName

EDIT: I should say that it will display the DN of the account in which context the script is run...


gpresult /r | find "OU"

will do it.


In Command Prompt,

whoami /fqdn

I've found that

gpresult -v|more 

also works for this.