Reading Nested Groupnames from Active Directory using Users SAMAccountName

user2527636

I need a function to recursively get all groups names a specified user (as function argument) is a member of. The Function header should look like this where SAMAccountName is the Username I want to get the groups from:

public List<string> GetUsersGroups(string SAMAccountName);

I hope you can help me.

Thanks in advance.

Jermu Virtanen

I'm assuming your problem is active directory side knowledge, not c#.

Basically task is ldap action, but I'll give examples using adfind that is quick and handy tool to output ldap queries to csv file for example. Functions you have to create by yourself.

There are 2 functions you need:

Function 1, find DN from samaccountname: adfind -dsq -f samaccountname=username

Function 2, find groups, including nested ones: adfind -f "(member:1.2.840.113556.1.4.1941:=CN=USERDN,OU=USERS,DC=DOMAIN,DC=COM)" samaccountname -list

Please find adfind syntax from joeware website: http://www.joeware.net/freetools/tools/adfind/usage.htm

For nested groups, more information: http://msdn.microsoft.com/en-us/library/aa746475(v=vs.85).aspx https://social.technet.microsoft.com/Forums/scriptcenter/en-US/f238d2b0-a1d7-48e8-8a60-542e7ccfa2e8/recursive-retrieval-of-all-ad-group-memberships-of-a-user?forum=ITCG

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Fetching Sharepoint Groupnames and users in group using web services in MOSS 2007

From Dev

SQL with Active Directory and nested groups/users

From Dev

Using LDAP to find Users in Active Directory - no Users?

From Dev

Add users to active directory using LDIFDE

From Dev

Read deleted users from Active directory

From Dev

VSTS Adding Users from Azure Active Directory

From Dev

Extract all users from active directory groups from multiple domains using Powershell?

From Dev

Reading .dcm files from a nested directory

From Dev

sAMAccountName is missing from Lightweight Directory Services instance

From Dev

Active Directory List of Users

From Dev

Active Directory Users homespace

From Dev

Add users to Active Directory

From Dev

Create users on Microsoft Active Directory using a Scripting Language

From Dev

Allowing users to log into web application using Active Directory with C#

From Dev

Create users on Microsoft Active Directory using a Scripting Language

From Dev

Display all users under all OUs in active directory using adLDAP?

From Dev

Active Directory - restricting permissions for users using different (native) apps

From Dev

New active directory users cannot login from client

From Dev

Setting login shell in SSS configuration for users from Active Directory

From Dev

Export all the users from a Active Directory server to CSV

From Dev

Autocomplete Textbox from Active Directory usind LDAP Users in php

From Dev

Adding Users from one Azure Active Directory to access an application in another Azure Active Directory

From Dev

Determine If Users Are In Active Directory With PowerShell

From Dev

Setting flags for users (Active Directory)

From Dev

Missing users in Centrify active directory

From Dev

Determine If Users Are In Active Directory With PowerShell

From Dev

Disable Active Directory Inactive Users

From Dev

Samba use Active Directory users

From Dev

Active Directory reading user attributes

Related Related

  1. 1

    Fetching Sharepoint Groupnames and users in group using web services in MOSS 2007

  2. 2

    SQL with Active Directory and nested groups/users

  3. 3

    Using LDAP to find Users in Active Directory - no Users?

  4. 4

    Add users to active directory using LDIFDE

  5. 5

    Read deleted users from Active directory

  6. 6

    VSTS Adding Users from Azure Active Directory

  7. 7

    Extract all users from active directory groups from multiple domains using Powershell?

  8. 8

    Reading .dcm files from a nested directory

  9. 9

    sAMAccountName is missing from Lightweight Directory Services instance

  10. 10

    Active Directory List of Users

  11. 11

    Active Directory Users homespace

  12. 12

    Add users to Active Directory

  13. 13

    Create users on Microsoft Active Directory using a Scripting Language

  14. 14

    Allowing users to log into web application using Active Directory with C#

  15. 15

    Create users on Microsoft Active Directory using a Scripting Language

  16. 16

    Display all users under all OUs in active directory using adLDAP?

  17. 17

    Active Directory - restricting permissions for users using different (native) apps

  18. 18

    New active directory users cannot login from client

  19. 19

    Setting login shell in SSS configuration for users from Active Directory

  20. 20

    Export all the users from a Active Directory server to CSV

  21. 21

    Autocomplete Textbox from Active Directory usind LDAP Users in php

  22. 22

    Adding Users from one Azure Active Directory to access an application in another Azure Active Directory

  23. 23

    Determine If Users Are In Active Directory With PowerShell

  24. 24

    Setting flags for users (Active Directory)

  25. 25

    Missing users in Centrify active directory

  26. 26

    Determine If Users Are In Active Directory With PowerShell

  27. 27

    Disable Active Directory Inactive Users

  28. 28

    Samba use Active Directory users

  29. 29

    Active Directory reading user attributes

HotTag

Archive