Login | |
|
 |
Re: Modify Active Directory ACL for a Group - 2/27/2005 6:44:24 PM
|
|
 |
|
| |
token
Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
|
The following script will add a universal group into a domain local group from the same domain (you can easily modify it to reflect the actual group, OU, or domain). It will also grant universal group F/C permission to the domain local group object in AD. ================================================================================ Option Explicit Dim DLPath, UPath, DL, member, found, sd, dacl, ace DLPath = "LDAP://cn=domain local,ou=level 2,ou=level 1,dc=mydomain,dc=com" UPath = "LDAP://cn=universal,ou=level 2,ou=level 1,dc=mydomain,dc=com" Set DL = GetObject(DLPath) Set sd = DL.Get("ntSecurityDescriptor") Set dacl = sd.DiscretionaryAcl Set ace = CreateObject("AccessControlEntry") found = False For Each member In DL.members If UCase(member.adspath) = UCase(UPath) Then WScript.Echo """" & member.cn & """ already exists In """ & DL.cn & """" found = True Exit For End If Next If found = False Then dl.Add(UPath) dl.setinfo ace.accessmask = -1 ace.acetype = 0 ace.aceflags = &H2 ace.trustee = GetObject(UPath).cn dacl.addace ace sd.discretionaryacl = dacl DL.put "ntSecurityDescriptor", sd DL.setinfo WScript.Echo """" & GetObject(UPath).cn & """ successfully added To """ & DL.cn & """" End If
|
|
| |
|
|
|
 |
Re: Modify Active Directory ACL for a Group - 3/22/2005 11:36:02 AM
|
|
 |
|
| |
chan_fookmun
Posts: 22
Score: 0
Joined: 3/17/2005
From:
Status: offline
|
Hello token, the code which you have given me does not seem to work on my instance of ADAM.I have a OU(OU=student,O=KKK,C=SG) and i want to grant generic read access of this OU to a group(CN=grouptest,CN=Roles,O=KKK,C=SG). The error which i receive is "The security ID structure is invalid" at (14,1) Here is my code: Option Explicit Dim ou, sd, dacl, ace Set ou = GetObject("LDAP://capia1.capd.com:389/OU=student,O=KKK,C=SG") Set sd = ou.Get("ntSecurityDescriptor") set dacl = sd.DiscretionaryAcl Set ace = CreateObject("AccessControlEntry") ace.trustee = "CN=grouptest,CN=Roles,O=KKK,C=SG" ace.accessmask = &h80000000 ace.aceflags = &H3 ace.acetype = 0 dacl.addace ace sd.DiscretionaryAcl = dacl ou.Put "ntSecurityDescriptor", sd ou.SetInfo Thanks for your help.....
|
|
| |
|
|
|
|
|