Active directory: Get users associated with groups

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Mark (dont_at_spam.me)
Date: 03/13/05


Date: Mon, 14 Mar 2005 11:13:40 +1300

Hi, can anyone please tell me (Given a group name) how I can retrieve just
those users associated with that group using Active Directory using LDAP??

I am using the code below with not much luck

[code]
DirectoryEntry entry = new DirectoryEntry("LDAP://" +
Domain,"LoginUser","Password");
DirectorySearcher Dsearch = new DirectorySearcher(entry);
Dsearch.Filter = "objectCategory =All users"; // All users is a group in AD
[/code]

TIA
Mark



Relevant Pages

  • Re: Need assistance badly!
    ... I have tried cobbling together a script that does this, ... I would use ADO in a VBScript program to retrieve all users with the ... Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strName, strCN ... adoConnection.Open "Active Directory Provider" ...
    (microsoft.public.scripting.vbscript)
  • Re: domain name/LDAP redundancy
    ... The app currently contacts one of the DC's for the LDAP search however, ... uses ADO to retrieve the Distinguished Names of all users in the domain. ... adoConnection.Open "Active Directory Provider" ...
    (microsoft.public.windows.server.active_directory)
  • Re: Bulk unlock user accounts
    ... following script from some sample on the Microsoft site. ... It makes more sense to retrieve distinguishedName. ... Dim strDN, objUser ... ' Use ADO to search Active Directory. ...
    (microsoft.public.scripting.vbscript)
  • Re: Add domain user to local group script troubleshoot
    ... The most reliable way to retrieve computer names in an Active Directory ... domain global group a member of each computers local Administrators group. ... >> Microsoft MVP Scripting and ADSI ...
    (microsoft.public.windows.server.scripting)
  • Re: Scripting newbie - Active Directory reporting of users/description
    ... Does any one have a sample script that looks at an Active Directory ... You can use ADO in a VBScript program to retrieve information about objects ...
    (microsoft.public.windows.server.scripting)