it-swarm.cn

如何确定Windows域中用户帐户的OU?

登录到域时,是否有任何方法(缺少Active Directory浏览器)查看我的OU?

29
Luke

这是一个快速的VBS脚本,您可以使用它来显示帐户的DistinguishedName属性,该属性包含帐户所在的OU:

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

编辑:我应该说它将显示在其中运行脚本的帐户的DN ...

14
squillman

gpresult/r |找到“ OU”

会做的。

47
MathewC

在命令提示符下,

whoami /fqdn
23
cychoi

我发现

gpresult -v|more 

也适用于此。

6
JJJJNR

用户:adfind -sc u:%username%dn

计算机:adfind -sc c:%computername%dn

Adfind可通过 http://www.joeware.net/freetools/tools/adfind/index.htm 获得

1
benPearce

我可以在cmd窗口中运行以下命令

gpresult /r | find "OU"

输出示例:

USER SETTINGS
--------------
CN=Lastname\, Firstname,OU=Users,OU=Toronto,DC=site,DC=com

    Last time Group Policy was applied: 1/24/2019 at 4:04:04 PM
    Group Policy was applied from:      dc.site.com
    Group Policy slow link threshold:   500 kbps
    Domain Name:                        SITE
    Domain Type:                        Windows 2008 or later

它还列出了您所属的用户组:

The user is a part of the following security groups
---------------------------------------------------
    Domain Users
    Everyone
    BUILTIN\Administrators
    BUILTIN\Users
    Performance Log Users
    NT AUTHORITY\INTERACTIVE
    CONSOLE LOGON
    NT AUTHORITY\Authenticated Users
    This Organization
    LOCAL
    custom_security_linux_group
1
kevinf

在命令/ powershell提示符下:

dsquery user -name <your-user-name>
0
thetoolman