473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 5750
>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
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
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
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
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
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
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
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
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
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 =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.