This is a part of an on-going blog series written by Adam Gordon. Each week, Adam will walk you through a PowerShell command, showing you when and how to use each one. This week, Adam covers Get-Acl.
When to use Get-Acl
Anytime you need to get the security descriptor for a resource, such as a file or registry key.
How to use Get-Acl
Get the security descriptor of a specified directory or file:
Get-Acl “C:\Windows” | FL
This command gets the security descriptor of the “C:\Windows” directory and uses the FL alias to output into a formatted list.
Get the security descriptor of a specified registry key or subkey:
Get-Acl -Path HKLM:\System\CurrentControlSet\Control | Format-List
This command uses the Get-Acl cmdlet to get the security descriptor of the Control subkey (HKLM\SYSTEM\CurrentControlSet\Control) of the registry.
The Path parameter specifies the Control subkey. The pipeline operator (|) passes the security descriptor that Get-Acl gets to the Format-List command, which formats the properties of the security descriptor as a list so that they are easy to read.
Need PowerShell training? Check out ITProTV’s PowerShell online IT training courses.