2013-01-24 58 views
0

我想要完成的所有操作都是在LDAP組中有任何成員時返回。所以,我有一個組列表,我想查詢每個組的列表,以確保每個組中至少有一個成員。如何使用不在MS Active Directory中使用Powershell查詢LDAP組的成員

我正在使用powershell,這不是活動目錄。

這是目前我試圖

$user = "username" 
$pwd = "password" 
$de = "LDAP://[SERVERNAME]/cn=user,ou=people,o=company" 
$deObject = New-Object -TypeName System.DirectoryServices.DirectoryEntry($de,$user,$pwd,'FastBind') 

這會返回一個DirectoryEntry對象(至少據我可以告訴)。我實在看不出任何屬性或任何東西,除了如果我做到以下幾點:

$deObject.Name 

這將返回「用戶」的CN,就是這樣。有什麼建議麼?

我已經試過:

$deObject.Properties 
$deObject.Properties['member'] 
$deObject.Properties.Values['member'] 

提前感謝!

+0

一些提示:HTTP://www.vistax64 .com/powershell/29100-bind-ldap-directory.html –

回答

2

這將顯示所有的屬性有:

$deObject | Format-List * -force 

這將返回成員的數量在一組:

$deObject.member.Count 
+0

謝謝。實際上,我可以使用'$ deObject.member'和'$ deObject.Name'獲取成員列表和完整的cn列表。 奇怪的是,'$ deObject |格式列表* -Force引發「未知錯誤(0x8000500c)」 – robbie

相關問題