using powershell to set file audit settings

from my understanding, I can use set-acl to add file/folder audit setting

can I somehow feed that command a text file that contains a list of file names that need the exact same audit settings?

For every new computer we set up, I need to change audit settings on 75-100 files with the exact same settings. We do this manually but would really like to script it.

The only code I found online is the following but it just copies the audit settings from one folder to another:

get-acl c:\users\administrator\desktop\test2\ -Audit| set-acl c:\users\administrator\desktop\test\

A simple loop should do it. Using a an existing ACL is easier than building one, which can be a bit fiddly.

$files = Get-Content c:\temp\fileList.txt

$acl = Get-ACL c:\myAuditTemplate\ -Audit

foreach ($file in $files) {

  Set-Acl -path $file -AclObject $acl

}

thanks.

I’ll test that out and see if I run into any issues.