Created
September 19, 2023 23:04
-
-
Save tankmek/446f1ad4593872454d6dfc9b55a9ee9e to your computer and use it in GitHub Desktop.
Ghost-Busting: Apply Audit ACL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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