Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2777
  • Last Modified:

How to get the group / cost Center of a user from ADSI

Hi All,

I created a linked server in SQL Server to my Active Directory using ADSDatasource. I am able to retrieve all the users with their name, displayname, network userid and all (objectclass = 'user'). But, I am struggling to identify the right field to retrieve the Group and Cost Center attributes of the users. I tried to use the "memberof" field but am getting an error stating that ADSI is resulting an error neither signage conversion nor overflow.

I am using

"Select * from Openquery(ADSI, 'Select name, DisplayName, SN, CN, ADSPath, from ''LDAP://mydomain.com'' where objectclass = ''user''')

Any suggestions to get these attributes of the users using one or multiple queries that would be greatly appreciated.

Thank You
0
Skerw
Asked:
Skerw
  • 2
1 Solution
 
x-menIT super heroCommented:
You can't get "multiple valued fields" from OpenQuerys. What I do is get the info by vbs and load it to SQL.

more in:
http://www.rlmueller.net/SQLDistributedQuery.htm
0
 
SkerwAuthor Commented:
So, what is the best approach to get the multiple vaued fields. What is the common field between "user" object class and Group object class?
0
 
x-menIT super heroCommented:
use vbscript to query the AD (there is a sample script in that same site) and load a table  (temporary or whatever) in SQL.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now