使用PowerShell搜索AD而不使用AD模块(RSAT) [英] Search AD with PowerShell without using AD module (RSAT)
本文介绍了使用PowerShell搜索AD而不使用AD模块(RSAT)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ActiveDirectory模块随远程服务器管理工具(RSAT)一起提供。我想避免在PC客户端上安装RSAT。有没有一种方法可以不使用Active Directory模块来检索AD组的成员?
ActiveDirectory module comes with Remote Server Administration Tools (RSAT). I would like to avoid the installation of RSAT on PC client. Is there a way to retrieve members of AD group without using Active Directory module?
推荐答案
您可以使用 [ADSI]
进行LDAP查找:
You could use [ADSI]
to do an LDAP lookup:
$Group = [ADSI]"LDAP://CN=DistinguishedNameofGroup,DC=Example,DC=com"
$Group.Member
或者,您也可以使用 DirectoryServices.DirectorySearcher
类:
Alternatively you could use the DirectoryServices.DirectorySearcher
class:
$Search = New-Object DirectoryServices.DirectorySearcher("(&(objectCategory=group)(name=ExampleGroupName))")
$Results = $Search.FindAll()
$Results.Properties["Member"]
#As a one liner
([System.DirectoryServices.DirectorySearcher]"(&(objectCategory=group)(name=ExampleGroupName))").FindAll().Properties["Member"]
这篇关于使用PowerShell搜索AD而不使用AD模块(RSAT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文