Jump to content

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

Featured Replies

Posted

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"

--------------------------------------------------------

Tu peux aussi crire en franais.

Du kannst auch auf Deutsch schreiben.

Puoi scrivere anche in italiano.

--------------------------------------------------------

  • Author

Thanks :)

 

I am bit weak in scripting, please bear with me. Is that a powershell script ?

Yes it is.

 

With that script you set parameters for specific folder. You can use also parameters, just google a bit.

--------------------------------------------------------

Tu peux aussi crire en franais.

Du kannst auch auf Deutsch schreiben.

Puoi scrivere anche in italiano.

--------------------------------------------------------

Guest
Reply to this topic...