Answers:
这是一个快速的VBS脚本,您可以使用它来显示帐户的DistinguishedName属性,该属性包含帐户所在的OU:
set objSysInfo = CreateObject("ADSystemInfo")
set objUser = GetObject("LDAP://" & objSysInfo.UserName)
wscript.echo "DN: " & objUser.distinguishedName
编辑:我应该说,它将在运行脚本的上下文中显示帐户的DN ...
用户:adfind -sc u:%username%dn
计算机:adfind -sc c:%computername%dn
可在http://www.joeware.net/freetools/tools/adfind/index.htm上找到 Adfind
我能够在一个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