B
Bob Weiner
I have posted this to exchange2000.development and server.scripting without
success. Forgive me if I'm being pushy but I have a deadline rushing at
me(like I'm the only one!).
This doesn't seem to me to be an overly difficult question though I admit
that I cannot figure it out. The fact that it can be done manually with the
ADUC makes me believe that it is scriptable.
********************************************************
I need to give users the ability to update specific properties on AD objects
but am having trouble retrieving security descriptors on individual AD
object attributes.
I am using ADSI (of course) and ADsSecurity.dll to do this. My best attempt
thus far (which failed with a "catastrophic failure") is below.
A pointer would be greatly appreciated.
thanks,
bob
---------------------------------------------
Public Sub grant ( ByVal iadObj As IADs, _
ByVal dnTrustee As String, _
ByVal strAttribute as String )
Dim sd As IADsSecurityDescriptor
Dim dacl As IADsAccessControlList
Dim ace As AccessControlEntry
Dim propList As IADsPropertyList
Dim propEntry As IADsPropertyEntry
' create new ace
Set ace = New AccessControlEntry
With ace
.AceType = ADS_ACETYPE_ACCESS_ALLOWED
.Trustee = dnTrustee
.AccessMask = ADS_RIGHT_GENERIC_WRITE
End With
' retrieve the attribute object
Set propList = iadObj
propList.GetInfo
Set propEntry = propList.GetPropertyItem ( _
strAttribute, _
ADSTYPE_CASE_IGNORE_STRING )
' set the acl on that property
Set sd = ADsSecure.GetSecurityDescriptor(propEntry) ' BOOM!!!
Set dacl = sd.DiscretionaryAcl
dacl.AddAce ace
Set sd.DiscretionaryAcl = dacl
ADsSecure.SetSecurityDescriptor sd
End Sub
---------------------------------------------
success. Forgive me if I'm being pushy but I have a deadline rushing at
me(like I'm the only one!).
This doesn't seem to me to be an overly difficult question though I admit
that I cannot figure it out. The fact that it can be done manually with the
ADUC makes me believe that it is scriptable.
********************************************************
I need to give users the ability to update specific properties on AD objects
but am having trouble retrieving security descriptors on individual AD
object attributes.
I am using ADSI (of course) and ADsSecurity.dll to do this. My best attempt
thus far (which failed with a "catastrophic failure") is below.
A pointer would be greatly appreciated.
thanks,
bob
---------------------------------------------
Public Sub grant ( ByVal iadObj As IADs, _
ByVal dnTrustee As String, _
ByVal strAttribute as String )
Dim sd As IADsSecurityDescriptor
Dim dacl As IADsAccessControlList
Dim ace As AccessControlEntry
Dim propList As IADsPropertyList
Dim propEntry As IADsPropertyEntry
' create new ace
Set ace = New AccessControlEntry
With ace
.AceType = ADS_ACETYPE_ACCESS_ALLOWED
.Trustee = dnTrustee
.AccessMask = ADS_RIGHT_GENERIC_WRITE
End With
' retrieve the attribute object
Set propList = iadObj
propList.GetInfo
Set propEntry = propList.GetPropertyItem ( _
strAttribute, _
ADSTYPE_CASE_IGNORE_STRING )
' set the acl on that property
Set sd = ADsSecure.GetSecurityDescriptor(propEntry) ' BOOM!!!
Set dacl = sd.DiscretionaryAcl
dacl.AddAce ace
Set sd.DiscretionaryAcl = dacl
ADsSecure.SetSecurityDescriptor sd
End Sub
---------------------------------------------