473,480 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Remove A User From A Group

Ram
Hey,
I'v got a group in ActiveDirectory that has about 2000 members.
I want to remove a certain user from that group.
When I tried to remove it using the group's DirectoryEntry:
usersGroup.Children.Remove(userEntry) I get the following exception:
"Cannot Remove The Specified Item Because It Was Not Found In The Specified
Collection".
When I looked at the group's "Member" collection in the debug window, I saw
only the first 1500 results - all the other 500 and so users (among them the
user I tried to remove from that group) were not on that list.
I know for sure that the other 500 users are on that group because when I
look at the - "MemberOf" property of that users,
I get - among other groups - the current group.
Is there another way of doing so, that is not limited to a nomerouse number
of users?
Thanks ahead

--Ram
Nov 16 '05 #1
3 5758
>I'v got a group in ActiveDirectory that has about 2000 members.
I want to remove a certain user from that group.
When I tried to remove it using the group's DirectoryEntry:
usersGroup.Children.Remove(userEntry) I get the following exception:
"Cannot Remove The Specified Item Because It Was Not Found In The Specified
Collection".


there's a flaw in the system.directoryservices components for groups
with large number of members. one workaround is to use the native adsi
components instead.

marc
================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
Nov 16 '05 #2
Ram
Hey,
Thanks for the reply!
How can I use the native adsi instead?
Would:
dim userGroups as IadsGroups
userGroups = GetObject("MyGroupDN")
userGroups.Remove("MyUserDN")
userGroups.SetInfo()
- This work?
Thanks ahead

--Ram
"Marc Scheuner [MVP ADSI]" <m.********@inova.SPAMBEGONE.ch> wrote in message
news:8e********************************@4ax.com...
I'v got a group in ActiveDirectory that has about 2000 members.
I want to remove a certain user from that group.
When I tried to remove it using the group's DirectoryEntry:
usersGroup.Children.Remove(userEntry) I get the following exception:
"Cannot Remove The Specified Item Because It Was Not Found In The SpecifiedCollection".


there's a flaw in the system.directoryservices components for groups
with large number of members. one workaround is to use the native adsi
components instead.

marc
================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch

Nov 16 '05 #3
>How can I use the native adsi instead?
Would:
dim userGroups as IadsGroups
userGroups = GetObject("MyGroupDN")
userGroups.Remove("MyUserDN")
userGroups.SetInfo()
- This work?


Yes - add some error checking (e.g. check if the dim userGroup as
IADsGroup has succeeded), but then you should be okay, I think.

Marc

================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3044
by: Ramamoorthy Ramasamy | last post by:
Hi all, I would like to create a page with VBscript and ASP which will contain two list-boxes one in the left side and the other in the right side with two buttons namely "Add>>" and "<<Remove"...
11
2713
by: koperenkogel | last post by:
Dear cpp-ians, I am working with a vector of structures. vector <meta_segment> meta_segm (2421500); and the structure look like: struct meta_segment { float id; float num;
8
2623
by: Mikey | last post by:
I have an XML document as follows: <Menu> <Group> <Item Text="About Us" AccessRoles="All"> <Group> <Item Text="Option 1" AccessRoles="All" /> <Item Text="Option 2" AccessRoles="All" /> <Item...
2
1312
by: Johm | last post by:
I need some help in finding a way to remove the filter from the previous command. I open the report from a form where i have option group called Office.Depending on the option in the option...
4
8968
by: Bob Sanderson | last post by:
I set up a password protected Access Database and would like to now completely remove the password and any security functions. How do I do this? Any help will be greatly appreciated.
4
11473
by: Ron | last post by:
I've got a listbox that holds a list of groups. Users can select a group, hit the remove button and the group should be removed from the listbox. The only problem is that no matter which group you...
1
5679
by: Jeff User | last post by:
Hi ..net 1.1 I have a simple string array like string myArray = CallToWebServiceThat_Returns_Elements; I want to remove an item from the array and also remove its position. I can search the...
3
1793
by: wolfing1 | last post by:
how would I go doing it without javascript and using 'POST'? Having a page with a variable list of items in a shopcart, each item with its own 'remove' button. How could I do this without a...
1
5224
by: John | last post by:
Hi, I have the code snippet but it does not seem to work, could anyone point me out what wrong with it? //try to remove a local user from a local group string path =...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7045
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7087
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4782
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4483
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2985
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.