0
好的,所以我已經有一個現有的連接到我的服務器上的Active Directory。我知道查詢活動目錄的作品。我希望能夠做的是查詢活動目錄中的所有ou和/或組,並且還能夠查找屬於這些組的用戶。Active Directory組與SQL Server 2005
這是剛剛拉(成立於把所有用戶的存儲過程或部分)的用戶信息的當前查詢:
SELECT
userAccountControl,
DisplayName AS [NAME],
givenName AS FIRSTNAME,
middleName,
sn AS LASTNAME,
employeeID AS EMPID,
telephoneNumber AS EXT,
Title,
Department AS DEPT,
Division,
sAMAccountName AS UserName,
mail AS Email,
homeDirectory AS HomeDir,
userPrincipalName AS LOGON,
manager
FROM OPENQUERY(ADSI,
'
select
userAccountControl,
DisplayName,
givenName,
middleName,
sn,
employeeID,
telephoneNumber,
Title,
Department,
Division,
sAMAccountName,
mail,
homeDirectory,
userPrincipalName,
manager
from ''LDAP://name''
where sn > ''a''
and sn <''h''
order by DisplayName
')
AS derivedtbl_1
」這是當前查詢,只是拉用戶信息(或設置存儲過程的一部分拉動所有用戶):「 這是來自sp有5插入/選擇語句進入臨時表,然後與我們的數據倉庫數據庫中的表進行比較並更新表格 – DForck42 2009-05-05 15:59:27