Yep adfind would do it for any user. If this is for a logon
script or something like that where you need one of the names of the current
user you could use my username tool as well. It can output multiple formats and
if you want it can generate a little cmd file which will define vars for several
of the name formats...
[Wed 01/04/2006
14:57:58.95]
F:\DEV\cpp\UserName>username -f test.cmd
F:\DEV\cpp\UserName>username -f test.cmd
UserName V01.00.00cpp Joe Richards ([EMAIL PROTECTED])
October 2002
Attempting to write test.cmd
File written
File written
[Wed 01/04/2006
14:58:05.78]
F:\DEV\cpp\UserName>type test.cmd
set UN-DN=CN=$jricha34,CN=Users,DC=joe,DC=com
set UN-SAM=JOE\$jricha34
set UN-Display=$jricha34
set UN-Canonical=joe.com/Users/$jricha34
set [EMAIL PROTECTED]
F:\DEV\cpp\UserName>type test.cmd
set UN-DN=CN=$jricha34,CN=Users,DC=joe,DC=com
set UN-SAM=JOE\$jricha34
set UN-Display=$jricha34
set UN-Canonical=joe.com/Users/$jricha34
set [EMAIL PROTECTED]
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Al Mulnick
Sent: Wednesday, January 04, 2006 12:57 PM
To: [email protected]
Subject: Re: [ActiveDir] Locating which OU a specific use account is in
Script? Have you seen Joeware.net's
adfind.exe ?
How about DSQUERY?
If you really wanted to do that in script you could. There's likely
enough examples to cobble together something like that on scriptcenter
(technet).
Does that help? If not, can you expand on why you would want to know the OU
a user is in? Do you need to write this to a file? Use it for something
else?
On 1/4/06, Navroz
Shariff <[EMAIL PROTECTED]>
wrote:
Dear list,Does anyone know of a script that, when a domain username is entered, would locate which OU the account is located in if, for the sake of argument, the OU structure in AD was designed in a way that user accounts were separated?Thanks advance,-Nav
