Skip to content

Instantly share code, notes, and snippets.

@tankmek
Created September 19, 2023 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tankmek/446f1ad4593872454d6dfc9b55a9ee9e to your computer and use it in GitHub Desktop.
Save tankmek/446f1ad4593872454d6dfc9b55a9ee9e to your computer and use it in GitHub Desktop.
Ghost-Busting: Apply Audit ACL
# Retrieve the current ACL
$acl = Get-Acl -Path .\private_file.txt
# Define the audit rule for Everyone with Success and Failure auditing for Read
$auditRule = New-Object System.Security.AccessControl.FileSystemAuditRule("Everyone", "Read", "Success,Failure")
# Add the audit rule to the ACL
$acl.AddAuditRule($auditRule)
# Apply the modified ACL to the file
Set-Acl -Path .\private_file.txt -AclObject $acl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment