PowerShell的Active Directory属性 [英] Powershell active directory properties
本文介绍了PowerShell的Active Directory属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想找到活动目录的属性:
$ strFilter的=(及(objectCategory属性=用户))
$ objDomain会=新对象System.DirectoryServices.DirectoryEntry
$ objSearcher =新对象System.DirectoryServices.DirectorySearcher
$ objSearcher.SearchRoot = $ objDomain会
$ objSearcher.PageSize = 1000
$ objSearcher.Filter = $ strFilter的
$ objSearcher.SearchScope =子树
$ colResults = $ objSearcher.FindAll()
的foreach($ objResult在$ colResults){
$ objItem = $ objResult.Properties
我可以调用$ objitem.name,但我不知道其他属性我有访问。
我如何才能找到它的属性,我可以从$ objitem访问?
编辑:
用于使用回答以下这个解决方案:
的foreach($ objResult在$ colResults){
($ colResults)[0] .Properties.PropertyNames
}
解决方案
的foreach($ objResult在$ colResults){ $ objResult.Properties | %{$ _。propertynames} }
应该显示每个结果属性的钥匙。
I am trying to find the properties of active directory:
$strFilter = "(&(objectCategory=User))"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.PageSize = 1000
$objSearcher.Filter = $strFilter
$objSearcher.SearchScope = "Subtree"
$colResults = $objSearcher.FindAll()
foreach ($objResult in $colResults){
$objItem = $objResult.Properties
I can call $objitem.name, but I don't know which other properties I have accessible.
How can I find which properties I can access from $objitem?
edit:
Used this solution using the answers below:
foreach ($objResult in $colResults){
($colResults)[0].Properties.PropertyNames
}
解决方案
foreach ($objResult in $colResults){ $objResult.Properties | % {$_.propertynames} }
should display the keys of each result property.
这篇关于PowerShell的Active Directory属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文