# Get-ACL and PowerShell 2

**URL:** <https://forums.powershell.org/t/get-acl-and-powershell-2/22257>\
**Category:** PowerShell Help\
**Created:** [May 1, 2023, 10:42pm UTC](https://forums.powershell.org/t/get-acl-and-powershell-2/22257 "2023-05-01T22:42:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)\
**Post date:** [May 1, 2023, 10:42pm UTC](https://forums.powershell.org/t/get-acl-and-powershell-2/22257/1 "2023-05-01T22:42:01Z")

</div>

Please … no flames … I really do need to update PowerShell 2 code for legacy air gapped XP systems.

I have this simple example.

```auto
$Folder = 'C:\Some\Folder'
$ACL = Get-Acl -Path $Folder -Audit

```

This works peachy in both PS2 and beyond.

However, I need the audit flags. This works fine in PowerShell 5.1 and beyond

```auto
$ACL.Audit.AuditFlags

PS C:\> $ACL.Audit.AuditFlags
Success, Failure
PS C:\>

```

This does not work in PowerShell 2. I can see the properties exist as such:

```auto
PS C:\> $ACL.Audit

FileSystemRights : ExecuteFile, DeleteSubdirectoriesAndFiles, Write, Delete, ReadPermissions, ChangePermissions, TakeO
                    wnership
AuditFlags : Success, Failure
IdentityReference : Everyone
IsInherited : False
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None

```

However, when I attempt the same syntax as such, it returns nothing:

```auto
PS C:\> $ACL.Audit.AuditFlags
PS C:\>

```

I can however get the values with another method:

```auto
$ACL.Audit | Select-Object -ExpandProperty 'AuditFlags'

PS C:\> $ACL.Audit | Select-Object -ExpandProperty 'AuditFlags'
Success, Failure
PS C:\>

```

Is this simply a limitation to PS2 and I need to use the longer syntax? I need pretty much all the properties from $ACL.Audit and would prefer to use the shorter dotted notation if possible. I should point out I have only tested on PS2, 5.1 and 7.3 and nothing in between.

Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)\
**Post date:** [May 1, 2023, 11:33pm UTC](https://forums.powershell.org/t/get-acl-and-powershell-2/22257/2 "2023-05-01T23:33:58Z")

</div>

Disregard please … I played around enough and found the solution:

```auto
$ACL.Audit[0].AuditFlags

```

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:14pm UTC](https://forums.powershell.org/t/get-acl-and-powershell-2/22257/3 "2024-05-16T20:14:55Z")

</div>

Closed on May 16, 2024, 8:14pm UTC


