Get-Permission

Gets the permissions (access control rules) for a file, directory, registry key, or certificate's private key/key container.

Syntax

Get-Permission [-Path] <String> [[-Identity] <String>] [-Inherited] [<CommonParameters>]

Description

Permissions for a specific identity can also be returned. Access control entries are for a path's discretionary access control list.

To return inherited permissions, use the Inherited switch. Otherwise, only non-inherited (i.e. explicit) permissions are returned.

Certificate permissions are only returned if a certificate has a private key/key container. If a certificate doesn't have a private key, $null is returned.

Related Commands

Parameters

Name Type Description Required? Pipeline Input Default Value
Path String

The path whose permissions (i.e. access control rules) to return. File system, registry, or certificate paths supported. Wildcards supported.

true false
Identity String

The identity whose permissiosn (i.e. access control rules) to return.

false false
Inherited SwitchParameter

Return inherited permissions in addition to explicit permissions.

false false False

Return Values

System.Security.AccessControl.AccessRule.

EXAMPLE 1

Get-Permission -Path 'C:\Windows'

Returns System.Security.AccessControl.FileSystemAccessRule objects for all the non-inherited rules on C:\windows.

EXAMPLE 2

Get-Permission -Path 'hklm:\Software' -Inherited

Returns System.Security.AccessControl.RegistryAccessRule objects for all the inherited and non-inherited rules on hklm:\software.

EXAMPLE 3

Get-Permission -Path 'C:\Windows' -Idenity Administrators

Returns System.Security.AccessControl.FileSystemAccessRule objects for all the Administrators' rules on C:\windows.

EXAMPLE 4

Get-Permission -Path 'Cert:\LocalMachine\1234567890ABCDEF1234567890ABCDEF12345678'

Returns System.Security.AccessControl.CryptoKeyAccesRule objects for certificate's Cert:\LocalMachine\1234567890ABCDEF1234567890ABCDEF12345678 private key/key container. If it doesn't have a private key, $null is returned.