[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2010-11-30
3
Medium Priority
?
2,683 Views
Last Modified: 2012-05-10
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
Comment
Question by:Skerw
  • 2
3 Comments
 
LVL 18

Expert Comment

by:x-men
ID: 34238075
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
 

Author Comment

by:Skerw
ID: 34303375
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
 
LVL 18

Accepted Solution

by:
x-men earned 2000 total points
ID: 34317547
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question