July 28, 2011 at 1:48 pm
THIS WORKS FOR ME :
DECLARE @Application TABLE (cn varchar(50));
DECLARE @ApplicationCN varchar(50);
DECLARE @SQLString nvarchar(MAX);
DECLARE @Role varchar(50) = 'xxx';
DECLARE @ApplicationName varchar(50) = 'aaa';
SET @SQLString='SELECT cn FROM OPENQUERY(ADSI,''SELECT cn FROM ''''LDAP://prod.edframework.com''''
WHERE objectClass=''''msDS-AzApplication'''' AND msDS-AzApplicationName='''''+@ApplicationName+''''''')';
INSERT @Application EXEC(@SQLString);
SET @ApplicationCN=(SELECT TOP 1 cn FROM @Application);
SET @SQLString='SELECT givenName,sn,samAccountName,cn FROM OPENQUERY(ADSI,''SELECT cn FROM ''''LDAP://prod.edframework.com''''
WHERE msDS-MembersForAzRoleBL=''''CN='+@Role+',CN=AzRoleObjectContainer-'+@ApplicationCN+',CN='+@ApplicationCN+
',CN=US,OU=EDFrameworkAuthorizationStores,DC=prod,DC=edframework,DC=com'''''')'
PRINT (@SQLString);
Viewing post 16 (of 15 total)
You must be logged in to reply to this topic. Login to reply