PowerShell的Active Directory属性

编程入门 行业动态 更新时间:2024-10-19 13:26:06
本文介绍了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属性

本文发布于:2023-11-15 05:41:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1591644.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   PowerShell   Active   Directory

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!