PowerShell 技能连载 - 查找所有域控制器

如果您安装了免费的 Microsoft RSAT tools,那么您就拥有了 ActiveDirectory 模块。以下是一个查找组织中所有域控制器的简单方法:

1
2
3
4
#requires -Module ActiveDirectory

$filter = '(&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))'
Get-ADComputer -LDAPFilter $filter

基本上,您可以运行任意的 LDAP 过滤器查询。只需要选择合适的 cmdlet,例如 Get-ADComputerGet-ADUser 或最通用的 Get-ADObject

PowerShell 技能连载 - 查找所有域控制器

http://blog.vichamp.com/2017/10/10/find-all-domain-controllers/

作者

吴波

发布于

2017-10-10

更新于

2022-07-06

许可协议

评论