473,325 Members | 2,342 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,325 software developers and data experts.

Remove ACE Entries from AD groups - vb.net

I'm trying to remove ACE's from Group ACL's using vb.net. Here is the sub i'm using:

Expand|Select|Wrap|Line Numbers
  1.     Public Sub fixacl(ByVal grouppath As String)
  2.  
  3.         Dim oSecurityDescriptor As New ActiveDs.SecurityDescriptor
  4.         Dim dacl As New ActiveDs.AccessControlList
  5.         Dim ace As New ActiveDs.AccessControlEntry
  6.         Dim group As New DirectoryServices.DirectoryEntry(grouppath)
  7.  
  8.         'On Error Resume Next
  9.  
  10.         oSecurityDescriptor = group.Properties("ntSecurityDescriptor").Value
  11.         dacl = oSecurityDescriptor.DiscretionaryAcl
  12.  
  13.         lblStat.Text = "Setting groups ACL"
  14.         lblStat.BackColor = Color.Yellow
  15.         lblStat.Update()
  16.  
  17.         For Each ace In dacl
  18.  
  19.             If ace.Trustee = "ABC\Domain Admins" _
  20.                 Or ace.Trustee = "BUILTIN\Account Operators" _
  21.                 Or ace.Trustee = "BUILTIN\Windows Authorization Access Group" _
  22.                 Or ace.Trustee = "ABC\grpname" Then
  23.  
  24.                 dacl.RemoveAce(ace)
  25.  
  26.             End If
  27.  
  28.         Next
  29.  
  30.         group.Properties("ntSecurityDescriptor").Value = dacl
  31.         group.CommitChanges()
  32.  
  33.     End Sub
Line 30 in this code is throwing the following:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in system.directoryservices.dll

Additional information: One or more input parameters are invalid

Anyone have any ideas on this? i've never worked with programming of ACL's before so this is new to me. and i cannot seem to find anything to help me out with this.
Oct 31 '08 #1
0 865

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: frank | last post by:
I have two DataTables, A and B. Both have the primary key "CID". How do I remove all entries in Table A from Table B (with the same PK)?
4
by: Michael A. Covington | last post by:
Greetings, I am working on a program that is in beta testing and goes through a new version every week or so. When there's a new version, go into the setup project change the Product Code but...
14
by: BarrySDCA | last post by:
I have a database being populated by hits to a program on a server. The problem is each client connection may require a few hits in a 1-2 second time frame. This is resulting in multiple database...
31
by: Extremest | last post by:
I have a loop that is set to run as long as the arraylist is > 0. at the beginning of this loop I grab the first object and then remove it. I then go into another loop that checks to see if there...
7
by: WhiteClaw48 | last post by:
I'm working on an app that takes live data that is constantly fed in and lists it in a datagrid on a webpage. So it gets an entry and feeds it to the webpage. Then what I'd like to happen next...
1
by: gregelliott | last post by:
Hi, I'm trying to select the top 10 entries from a table per a variable. At present the below query brings up only 10 entries but I want 10 entries per segmentcode. SELECT top 10 * FROM...
1
by: robertstone | last post by:
The following code is meant to take a set of entry elements and while iterating through them using recursion, output a <spanspec> tag for each unique set of @namest and @nameend attributes found in...
2
by: Shyckymn | last post by:
How do I delete some entries that are result of the query below? db2 list history containing schema.table for database I want to remove some entries from the List History command. It is...
36
by: laredotornado | last post by:
Hi, I'm using PHP 5. I have an array of strings. What is the simplest way to remove the elements that are empty, i.e. where the expression "empty($elt)" returns true? Thanks, - Dave
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...

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.