Powershell 7 get Aduit settings on file/folder

Belan Marek 51 Reputation points

Hi all please how can i get audit setting of file / folder by powershell 7?
On PS 5 is method GetAccessControl('Access, Audit').AreAuditRulesProtected

I need to check if audit settings has enabled inheritance.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,454 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. Limitless Technology 39,496 Reputation points

    Hi @Belan Marek

    Kindly run following query in administrator mode.

     $path = "C:\Users\ravi2_000\OneDrive\Desktop\Loan"  
     $f = Get-Item $path  
     $f.GetAccessControl('Access, Audit').AreAuditRulesProtected  

    Result would be as below,

    Path Owner / Access
    5CD4392B17\ravi2_000 NT AUTHORITY\SYSTEM Allow FullControl...

    Here is a helpful page with information about Windows PowerShell



    --If the reply is helpful, please Upvote and Accept as answer.--