English 中文(简体)
2. 主动目录
原标题:Powershell active directory properties

我试图找到活性名录的特性:

$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

我可以称之为“objitem.name”,但我不知道我可以找到哪些其他财产。

我如何能找到我能从“obj”项目获得哪些财产?

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.

问题回答

Use the get-member (aliased as gm) cmdlet to get all the properties and methods. Like so,

$objItem | gm

另一种方式是将物体推到format-list(别名fl)厘米dlet上,该圆点获得了t list方法。 同样,

$objItem | fl *

Ok, preceding answers are "Powershell" features. If you really want to know what are the attributes you can reach for a given class (clas user here) you have to have a look to the Schema. which is avaible on Windows server registering the schmmgmt.dll COM object.

C:>regsvr32 c:WINDOWSsystem32schmmgmt.dll

JP





相关问题
Using JavaScript to get an LDAP multi-valued string attribute

I am trying to retrieve an object attribute in Active Directory that appears to be a multi-valued string (See canonicalName). After performing a search: var conn; conn.Open = Provider=ADsDSOObject; ...

Test "User Must Change Password" field in .Net 3.5

I m trying to perform some basic AD User managment tasks in C# using .Net 3.5 I ve got a System.DirectoryServices.AccountManagement.UserPrincipal object that contains the user details. I can call ...

SSIS Script Task connecting to AD

I have written a SSIS 2005 script task that connects to Active Directory and reads user accountnames to store in database. I was able to successfully test this on my local system by executing dtexec....

Update Full Name in Active Directory

I ve been thrust into the deep end with Active Directory (I m a web developer, go fig) I have a user that I ve changed first/last name on but the Full Name hasn t changed which is causing issues with ...

Authenticate against Active Directory/ISA from php [closed]

I have a complicated problem, exacerbated by the fact I don t really know where to start! Over the last few years, I ve developed a number of php web-based systems. When I built them, our network was ...

热门标签