question

BelanMarek avatar image
0 Votes"
BelanMarek asked RichMatheisen-8856 edited

Powershell 7 get Aduit settings on file/folder

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.
198689-image.png


windows-server-powershell
image.png (81.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered RichMatheisen-8856 edited

Why not use a PowerShell cmdlet to get that information?

Get-ACL -Path <path-to-file> -Audit

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered BelanMarek commented

Hi @BelanMarek

Kindly run following query in administrator mode.

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

Result would be as below,

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

Here is a helpful page with information about Windows PowerShell

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/powershell


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

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi

please you get working this on powershell 7 as i write on title ????????

0 Votes 0 ·