Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Query Active Directory

Posted on 2010-08-23
4
Medium Priority
?
860 Views
Last Modified: 2012-05-10
So I have gotten this far from information I have found but what I need to get is the names of the individuals that belong to this group and not the actual groupd name.  Don't query active Directory much so don't really know what I am doing.  How do i get the personnel whom belong to this group.

select cn, distinguishedName

from openquery(ADSI,'SELECT cn, distinguishedName

FROM "Sever Name"

WHERE objectCategory = ''group''

and CN = ''NGMN SEC J6 Voc''

')
0
Comment
Question by:kdeutsch
  • 3
4 Comments
 
LVL 6

Accepted Solution

by:
Jerryuk007 earned 1600 total points
ID: 33501990
Have a look at spQueryAD (http://www.tek-tips.com/viewthread.cfm?qid=1273100&page=2)

I created that SP on MSSQL 2008, and then an SSIS to load the data into a MSSQL Table and sort them out the way I need.

Hope this helps.

Jerry
0
 

Author Comment

by:kdeutsch
ID: 33502973
Jerryuk007,

i will have to look into that for future use, currently I am trying to trace some Vb code that hits AD and gets the users that fall under this account and then emails them.  So I would have to put a lot of work into changing the whole thing, which I don't have time to do.  Just wondering if there is a way to get the users that belong to this distribution account.
0
 

Author Comment

by:kdeutsch
ID: 33513772
Came down to problem with account in AD, awarding Jerryuk007: some points for the code that will allow us to copy out Ad abojects.
0
 

Author Closing Comment

by:kdeutsch
ID: 33513799
Really was not the solution but wanted to award some popints for the code, but this question did not give me a choice to accept my solution and award points to others.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

877 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