nick122211
Technical User
Ok I am trying to write a little program (3 days work now) that will take one user and assign him rights to another users account to send as. (more rights once I get this one working). I am getting a Member not found error when I run this code. Most of this code is from a sample I am trying to modify.
Dim ObjResource = GetObject("LDAP://" & resource)
'Get Security Desc
Const ADS_ACETYPE_ACCESS_ALLOWED_OBJECT = &H5
Const ADS_FLAG_OBJECT_TYPE_PRESENT = &H2
Const ADS_RIGHT_DS_CONTROL_ACCESS = &H100
Dim objSD = ObjResource("ntSecurityDescriptor")
Dim objDACL = objSD.DiscretionaryACL
Dim objAce = CreateObject("AccessControlEntry")
objAce.Trustee = DomainShort
objAce.AceFlags = 0
objAce.AceType = 5
objAce.Flags = 1
objAce.ObjectType = "{AB721A54-1E2F-11D0-9819-00AA0040529B}"
objAce.AccessMask = 256
objDACL.Addace(objAce)
objSD.DiscretionaryACL = objDACL
ObjResource.Put("ntSecurityDescriptor", ARRAY(objSD))
ObjResource.SetInfo()
Ok so here is the problem. VB.net won't compile with the ARRAY in the " ObjResource.Put("ntSecurityDescriptor", ARRAY(objSD))" line so I removed it and it compiles but fails. Any one know how to do this? Getting frustrated.
Thanks
Nick
Dim ObjResource = GetObject("LDAP://" & resource)
'Get Security Desc
Const ADS_ACETYPE_ACCESS_ALLOWED_OBJECT = &H5
Const ADS_FLAG_OBJECT_TYPE_PRESENT = &H2
Const ADS_RIGHT_DS_CONTROL_ACCESS = &H100
Dim objSD = ObjResource("ntSecurityDescriptor")
Dim objDACL = objSD.DiscretionaryACL
Dim objAce = CreateObject("AccessControlEntry")
objAce.Trustee = DomainShort
objAce.AceFlags = 0
objAce.AceType = 5
objAce.Flags = 1
objAce.ObjectType = "{AB721A54-1E2F-11D0-9819-00AA0040529B}"
objAce.AccessMask = 256
objDACL.Addace(objAce)
objSD.DiscretionaryACL = objDACL
ObjResource.Put("ntSecurityDescriptor", ARRAY(objSD))
ObjResource.SetInfo()
Ok so here is the problem. VB.net won't compile with the ARRAY in the " ObjResource.Put("ntSecurityDescriptor", ARRAY(objSD))" line so I removed it and it compiles but fails. Any one know how to do this? Getting frustrated.
Thanks
Nick