简体   繁体   English

使用 powershell 我想获取对域具有管理员权限的人员列表?

[英]Using powershell I'd like to get a list of people who have admin privileges for a domain?

I'd like to get a list of all people with admin privileges with powershell.我想获得所有具有 powershell 管理员权限的人的列表。 What is the most optimal way to accomplish that?实现这一目标的最佳方法是什么? Which user property should I look at?我应该查看哪个用户属性?

get-adgroupmember 'domain admins' | select name,samaccountname
get-adgroupmember 'enterprise admins' | select name,samaccountname

dsquery * -filter (samaccoutname="domain admin") | dsquery * -filter (samaccoutname="域管理员") | dsget group -members -expand >>RESULT.txt dsget group -members -expand >>RESULT.txt

The other examples show how to get the easiest display of who has "admin" access to a domain but don't overlook the fact that "admin" access can be directly assigned to any user or group object on the domain object itself.其他示例展示了如何最简单地显示谁对域具有“管理员”访问权限,但不要忽视“管理员”访问权限可以直接分配给域对象本身的任何用户或组对象的事实。 Simply checking for members of "domain admins" and "enterprise admins" is not going to show you the whole picture.简单地检查“域管理员”和“企业管理员”的成员并不能向您展示全貌。

As a starting point you could start with this and then investigate further:作为起点,您可以从这个开始,然后进一步调查:

(Get-ACL 'AD:\DC=MYDOMAIN,DC=local').Access | Format-Table IdentityReference,ActiveDirectoryRights,AccessControlType -AutoSize

I realize this question is old, and Noah's answer helped get me in the ballpark.我意识到这个问题很老了,诺亚的回答帮助我进入了球场。 I just want to expand on it a little bit more.我只是想进一步扩展它。 If you have multiple domains in your environment you can do something like this:如果您的环境中有多个域,您可以执行以下操作:

Get-ADGroupMember -Server "domain-name-here" -Identity "Domain Admins" -Recursive | Select Name

If you want to also see if which accounts are enabled or disabled:如果您还想查看是否启用或禁用了哪些帐户:

Get-ADGroupMember -Server "domain-name-here" -Identity "Domain Admins" -Recursive | Get-ADUser | Select Name, Enabled

Or if you only want to see enabled accounts:或者,如果您只想查看已启用的帐户:

Get-ADGroupMember -Server "domain-name-here" -Identity "Domain Admins" -Recursive | get-aduser -Properties Description | Where {$_.Enabled -eq $true} | Select Name 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM