Questions tagged [active-directory-group]

351 questions
52
votes
4 answers

Adding and removing users from Active Directory groups in .NET

I am writing the following methods to add and remove users from active directory in C#. void AddUserToGroup(string userId, string groupName); void RemoveUserFromGroup(string userId, string groupName); How best to implement these methods? Here is…
Ben Aston
  • 53,718
  • 65
  • 205
  • 331
51
votes
15 answers

See if user is part of Active Directory group in C# + Asp.net

I need a way to see if a user is part of an active directory group from my .Net 3.5 asp.net c# application. I am using the standard ldap authentication example off of msdn but I don't really see how to check against a group.
mike_h
  • 511
  • 1
  • 5
  • 3
26
votes
6 answers

Listing All Active Directory Groups

The following code lists some, but not all, Active Directory Groups. Why? I am trying to list all security groups, distribution groups, computer groups etc. Have I specified the wrong objectClass? private static void ListGroups() { …
cymorg
  • 437
  • 1
  • 8
  • 15
22
votes
3 answers

Get a list of members of a WinNT group

There are a couple of questions similar to this on stack overflow but not quite the same. I want to open, or create, a local group on a win xp computer and add members to it, domain, local and well known accounts. I also want to check whether a…
Kepboy
  • 3,733
  • 2
  • 30
  • 43
16
votes
2 answers

Getting members of an AD domain group using Sharepoint API

In my Sharepoint code I display a list of all defined users via: foreach (SPUser user in SPContext.Current.Web.AllUsers) { ... } The great part is, I can add a domain security group to a Sharepoint group (like Visitors) thus adding many users…
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
13
votes
6 answers

Server is unwilling to process the request - Active Directory - Add User via C#

I used the example in this page to add a user to an Active Directory group, but I get an exception with the message "Server is unwilling to process the request" when executing dirEntry.Properties["member"].Add(userDn);
Mauricio Ramalho
  • 849
  • 1
  • 8
  • 15
11
votes
3 answers

Listing users in ad group recursively with powershell script without CmdLets

I'm trying to list everyone in a security group in an active directory without using CmdLets in PowerShell. The weird thing with my script is that it works if I list the entire directory but if I try and specify with an ldap query what I want to be…
11
votes
2 answers

Add member to AD group from a trusted domain

I have two domains, in a trusted relationship, that I'm trying to manage from a C# web application. To do that, I have to impersonate two different technical users, but that works good, so I will not emphasize that part of the code. To build proper…
Laszlo T
  • 1,165
  • 10
  • 22
9
votes
5 answers

ASP.NET Membership - Which RoleProvider to use so User.IsInRole() checks ActiveDirectory Groups?

Very simple question actually: I currently have IIS anonymous access disabled, users are automatically logged on using their Windows login. However calling User.IsInRole("Role name") returns false. I double-checked User.Identity.Name() and the "Role…
Ropstah
  • 17,538
  • 24
  • 120
  • 194
9
votes
3 answers

Get members of an Active Directory group recursively, i.e. including subgroups

Given a group like this in Active Directory: MainGroup GroupA User1 User2 GroupB User3 User4 I can easily determine if User3 is member of MainGroup or any of its subgroups with code like this: using System; using…
Paolo Tedesco
  • 55,237
  • 33
  • 144
  • 193
9
votes
3 answers

How to get ALL AD user groups (recursively) with Powershell or other tools?

I'm trying to get ALL the groups a user is member, even the nested ones (recusively), in Powershell I'm using: (Get-ADUser -Properties MemberOf | Select-Object MemberOf).MemberOf But it only returns the groups the user is a "direct"…
esserafael
  • 195
  • 1
  • 1
  • 6
7
votes
3 answers

Find out if a group in AD is in Distribution group?

I'm using ASP.net with C# and have a very little idea about Active Directory. I've been given a task to write a program in steps below: The ASP.net application is given the username of a user. The application should query all the groups of the user…
7
votes
2 answers

Get groups from Active Directory using C#

I am having issues getting the groups from Active Directory via System.DirectoryServices Originally I started my application on a computer that was registered on the domain, but as it was a live domain I did not want to do any writes to AD what so…
RobertPitt
  • 56,863
  • 21
  • 114
  • 161
6
votes
1 answer

Everyone, All Users, and Authenticated Users in Azure Active Directory

I am using an Azure Analysis Services instance and need to grant access to all authenticated users in the domain. The problem is that I don't see any groups within our Azure AD tenant that resemble "everyone" or "authenticated users". It looks like…
EricTheil
  • 113
  • 1
  • 1
  • 7
6
votes
1 answer

What is the relationship, if any, between Active Directory groups and groups in Exchange?

Tasked with creating a login page that would allow members of two specific groups access to some controllers and actions in an MVC project, I set about to create a role provider for AD. I managed to get it configured with forms authentication, and…
Jay
  • 56,361
  • 10
  • 99
  • 123
1
2 3
23 24