Alan, not sure if it matters, but I usually do the
ADIS/LDAP calls more like this format... Check the
Linked Server also, for correct setup and security. Bruce
SELECT * FROM OPENQUERY( ADSI,'<LDAP://mydomain>;
((objectClass=User));distinguishedname,h
omePhone')
where distinguishedname like '%a%'
>--Original Message--
>I am trying to query our active directory for user
information, but even
>though I get the query to work I am getting no data
back. I have a linked
>server to the active directory from SQL Server 2000 and
I am running the
>query in the Query Analyzer.
>My query is as follows:
>select * from openquery(adsi, 'select name, homephone
from
>''ldap://DC=mydomain,DC=com'' where objectclass
= ''User'' ')
>This query will complete without error, but no data is
returned. I have
>seen one other question of this nature here, but I saw
no final resolution.
>What is wrong?
>Alan
>--
>Message posted via http://www.droptable.com
>.
>Bruce,
thanks for the response, but I tried what you suggested and still the query
returned no data. It completed without error just no data.
Thanks,
Alan
Message posted via http://www.droptable.com|||Alan, not sure why youre getting no data back then.
You're sure of the domain name? there's no special
security on your AD to prevent you from accessing? The
linked sever is setup correctly? like so..'
sp_addlinkedserver 'ADSI', 'Active Directory Service
Interfaces', 'ADSDSOObject', 'adsdatasource'
go
Are you sure the data sits in the User ObjectClass?
Might be somewhere else, check it.
There was a max 1000 row limit by default and we had to
have that kicked up to get more then 1000 rows returned.
These links talk about that...
http://support.novell.com/cgi-
bin/search/searchtid.cgi?/10081596.htm
http://www.ldapadministrator.com/fo...wtopic.php?t=14
>--Original Message--
>Bruce,
>thanks for the response, but I tried what you suggested
and still the query
>returned no data. It completed without error just no
data.
>Thanks,
>Alan
>--
>Message posted via http://www.droptable.com
>.
>|||Bruce,
I ran an export of the data in the user objects using ldifde and got back
exactly what I expected, but the same query in SQL Server Query Analyzer
comes back empty.
I guess it could be something with the link, but it was set up according to
the instructions I found on the web. The link was created in Enterprise
manager, but using the same settings that you specified in the
sp_addlinkedserver statement. It could also be a user security issue, but
I have tried logining in as the admin, SQL Sever admin and myself with no
data back.
Still playing around with it.
Alan
Message posted via http://www.droptable.com|||Finally, thanks Bruce. I was reading your posting and I was finally able to
pull data.
I'm trying to pull just users that are a member of a certain group, how can
I do that?
This is what I have but not working; however, I was able to used your query
just to get a start and that was a big help.
SELECT *
FROM OPENQUERY( ADSI,
'SELECT cn
FROM ''LDAP://internal/OU=Account
Executives,DC=internal,DC=homequest,DC=c
om''
WHERE objectClass = ''users''')
GO
"Bruce de Freitas" wrote:
> Alan, not sure if it matters, but I usually do the
> ADIS/LDAP calls more like this format... Check the
> Linked Server also, for correct setup and security. Bruce
>
> SELECT * FROM OPENQUERY( ADSI,'<LDAP://mydomain>;
> ((objectClass=User));distinguishedname,h
omePhone')
> where distinguishedname like '%a%'
>
>
> information, but even
> back. I have a linked
> I am running the
> from
> = ''User'' ')
> returned. I have
> no final resolution.
>|||Sonya, this query would list all the GROUPs.
SELECT * FROM OPENQUERY( adsi,'<ldap://mydomain>;
(&(objectCategory=GROUP)); distinguishedname,CN')
You'd then have to join all the Users to what groups they are in, if
that is what youre trying to do... Bruce
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!|||Thank you, after playing with it for awhile I was able to get it to work.
Do you know if there is a way to extract users' contact folder from the
server-level?
"Bruce de Freitas" wrote:
> Sonya, this query would list all the GROUPs.
> SELECT * FROM OPENQUERY( adsi,'<ldap://mydomain>;
> (&(objectCategory=GROUP)); distinguishedname,CN')
>
> You'd then have to join all the Users to what groups they are in, if
> that is what youre trying to do... Bruce
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!
>
Monday, March 26, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment