_대문 | 방명록 | 최근글 | 홈피소개 | 주인놈
FrontPage › AD계정조회

select 
    replace(substring(DistinguishedName, 1, charindex(',', DistinguishedName)-1), 'CN=', '') 이름
,   SamAccountName ID
,   mail
,   cn
,   co
from OPENROWSET(
    'ADsDSOObject'
,   'User ID=도메인\계정;Password=패스워드;ADSI Flag=0x11;Page Size=10000'
,   'select SamAccountName, DistinguishedName, mail, cn, co from 
    ''LDAP://도메인/OU=오유,OU=OU,DC=도메인,DC=COM'''
) a 
where 1=1
and DistinguishedName like '%이재학%'

openrowset으로 잘 안되면, linked server 세팅하고 openquery 해라.

댓글 남기기..
이름: : 오른쪽의 새로고침을 클릭해 주세요. 새로고침
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-05-03 23:00:17

지나간 시간에 후회하는 삶보단 다가오는 삶에 의미를 부여하는 시간이 더 아름답다.