Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
Are you a domain admin, or have access to the domain admin tools? –  Matt Simmons Jun 9 '09 at 19:44
add comment

4 Answers

up vote 11 down vote accepted

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...

share|improve this answer
    
You beat me to it by about 15 seconds! Zow... –  Evan Anderson Jun 9 '09 at 19:48
    
I beat him but for some reason gpresult /r doesn't work for everyone. "snaps fingers in lost pointage regret" ;-) –  MathewC Jun 9 '09 at 19:57
    
Aye, 'tis true :) +1 though, great command! –  squillman Jun 9 '09 at 20:05
add comment

gpresult /r

will do it.

share|improve this answer
    
Is this a windows command? Doesn't seem to work. –  Luke Jun 9 '09 at 19:48
    
/r doesn't work for me, although you do get almost everything otherwise with gpresult. –  Matt Hanson Jun 9 '09 at 19:48
    
When I do it there is a user setting section that shows the OU. –  MathewC Jun 9 '09 at 19:53
1  
Awesome command that I didn't know about. Thanks! +1 –  Matt Simmons Jun 9 '09 at 19:54
    
/R Displays RSoP summary data. –  MathewC Jun 9 '09 at 19:56
show 3 more comments

User: adfind -sc u:%username% dn

Computer: adfind -sc c:%computername% dn

Adfind available at http://www.joeware.net/freetools/tools/adfind/index.htm

share|improve this answer
    
adfind is one of my favorite AD tools. I <3 joeware. –  JamesBarnett Dec 28 '10 at 8:54
add comment

I've found that

gpresult -v|more 

also works for this.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.