SACL again

From: jbanek (jbanek@email.msn.com)
Date: 09/29/02


From: "jbanek" <jbanek@email.msn.com>
Date: Sun, 29 Sep 2002 13:07:54 -0400


I am trying to set SACL on folder c:\test3. Script below runs, there is no
error but SACL is not set.
Values for Ace.Flags and AccessMask are taken from first setting SACL on
directory
and then just list all properties using different script.
What am i doing wrong?

set fsoObject=CreateObject("Scripting.FileSystemObject")
set oADsSecurity = CreateObject("ADsSecurity")
set oTargetSD = oADsSecurity.GetSecurityDescriptor("file://c:\test3")
set oSacl = oTargetSD.SystemAcl
set oAcl = createobject("AccessControlList")
oAcl.AceCount = 1
oAcl.AclRevision = 4
set oAce = CreateObject("AccessControlEntry")
oAce.Trustee = "BUILTIN\Administrators"
oAce.AceType = 2
oAce.AccessMask = 851968
oAce.AceFlags = 195
'If I use statement belove I will get an error that oSacl object does not
exist, which is OK because by default SACL is not set.
' oSacl.AddAce oAce
oacl.AddAce oAce
oTargetSD.SystemAcl = oacl
oADsSecurity.SetSecurityDescriptor oTargetSD

Regards,
John