Command to modify Advanced Security Settings (Audit Settings for folders) on windows 2008

kseeker

Member
Joined
May 8, 2012
Messages
5
Hello All,
We have requirement to modify Advanced Security Settings (Audit Settings for folders) on windows 2008. I am looking for a command which does this job.
I know, using group policies I can do this in fact I had done this using group policies. However, I need to do this on number of servers which are not in domain. There are around 15 folders on which I need to enable Auditing manual editing folder advanced permissions is a cumbersome job. Hence, I am looking for a command line options.
I need to know how command can be utilised to enable Audit option on a folder. Please share a command which can do this once I get the command, I will create a batch file for other necessary folders.
Manually through GUI, I am setting following.. snaps are uploaded
Thanks
 
This should be what you need:

$AccLst = new-object System.Security.AccessControl.DirectorySecurity
$AccLst = Get-Acl "C:\MyFolder"
$AudRul = New-Object Security.AccessControl.FileSystemAudRul("everyone","Modify","ContainerInherit, ObjectInherit", "None", "success")
$AccLst.AddAudRul($AudRul)
$AccLst | Set-Acl "C:\MyFolder"
 
Back
Top