PowerShell Logo Small

Get-Acl



This is the built-in help made by Microsoft for the command 'Get-Acl', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Gets the security descriptor for a resource, such as a file or registry key.

SYNTAX


Get-Acl [[-Path] <string[]>] [-Audit] [-Exclude <string[]>] [-Filter <string>] [-Include <string[]>] [-UseTransaction] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Get-Acl cmdlet gets objects that represent the security descriptor of a file or resource. The security descriptor contains the access control
lists (ACLs) of the resource. The ACL specifies the permissions that users and user groups have to access the resource.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=113305
Set-Acl

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>get-acl C:\windows



Description
-----------
This command gets the security descriptor of the C:Windows directory.








-------------------------- EXAMPLE 2 --------------------------

C:\PS>get-acl C:\Windows\k*.log | format-list -property PSPath, Sddl



Description
-----------
This command gets the Windows PowerShell path and SDDL for all of the .log files in the C:\Windows directory whose names begin with "k."

The command uses Get-Acl to get objects representing the security descriptors of each log file. It uses a pipeline operator (|) to send the resul
ts to the Format-List cmdlet. The command uses the Property parameter of Format-List to display only the PsPath and SDDL properties of each secur
ity descriptor object.

Lists are often used in Windows PowerShell, because long values appear truncated in tables.

The SDDL values are valuable to system administrators, because they are simple text strings that contain all of the information in the security d
escriptor. As such, they are easy to pass and store, and they can be parsed when needed.








-------------------------- EXAMPLE 3 --------------------------

C:\PS>get-ACL c:/windows/k*.log -Audit | foreach-object { $_.Audit.Count }



Description
-----------
This command gets the security descriptors of the .log files in the C:\Windows directory whose names begin with "k." It uses the Audit parameter
to retrieve the audit records from the SACL in the security descriptor. Then it uses the For-EachObject parameter to count the number of audit re
cords associated with each file. The result is a list of numbers representing the number of audit records for each log file.








-------------------------- EXAMPLE 4 --------------------------

C:\PS>get-acl -path hklm:\system\currentcontrolset\control | format-list



Description
-----------
This command uses Get-Acl 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 retrieves to the Format-Li
st command, which formats the properties of the security descriptor as a list so that they are easy to read.