Get-Acl – Separate output columns

Welcome Forums General PowerShell Q&A Get-Acl – Separate output columns

Viewing 2 reply threads
  • Author
    Posts
    • #246573
      Participant
      Topics: 10
      Replies: 13
      Points: 152
      Rank: Participant

      Hello,

      I’ve got the cmdlet:
      Get-Acl -Path ‘c:\path’ | Format-Table -wrap

      which provides a mixed column named ‘Access’
      it shows username and it’s access at the same column, how to separate user and the permission in a different columns?

      Thanks!

    • #246582
      Participant
      Topics: 8
      Replies: 568
      Points: 2,170
      Helping Hand
      Rank: Community Hero

      Access is made up of several properties. Format-Table is showing you a friendly view of a few of those properties. If you run this, you can see all of them.
      Get-Acl -Path C:\path | select -ExpandProperty Access
      Output

      [/crayon]

      By default, powershell displays objects with 5 or more members as a list like shown. If you want to coerce it to show table, just select the columns you want to see. Four or less will be a table.

      Get-Acl C:\Path | Select -ExpandProperty Access | Select IdentityReference,FileSystemRights,AccessControlType
      Output

      [/crayon]

      You may also consider using calculated properties to show friendlier columns

      Get-Acl .\aabc.ics | select -ExpandProperty Access | Select @{N="Target Identity";E={$_.IdentityReference}},@{N="Filesystem Rights";E={$_.FileSystemRights}},AccessControlType

      By the way, Format-Table is fine if you’re just viewing the information in an interactive session and it’s the last command in the pipeline. You can’t use the output from the Format-* cmdlets, such as Sort, Group, or Select. Also, if you try to Format-Table on the Access property, it’s also not pleasing to the eyes.

    • #246585
      Participant
      Topics: 10
      Replies: 13
      Points: 152
      Rank: Participant

      super. thanks

Viewing 2 reply threads
  • You must be logged in to reply to this topic.