< Back

Add-Acl

Fri Jan 10, 2020 6:37 pm

NAME Add-Acl



SYNOPSIS

Adds ACL Entries to Objects.





SYNTAX

Add-Acl [-Path <String[]>] [-Principal] <Object> [-Rights] <Array> [-PropagationFlags {None | NoPropagateInherit |

InheritOnly}] [-InheritanceFlags {None | ContainerInherit | ObjectInherit}] [-Inherit <Boolean>] [-Allow] [-Deny]

[<CommonParameters>]



Add-Acl [-Path <String[]>] [-Rules] <AccessRule[]> [<CommonParameters>]





DESCRIPTION

Used to simplify ACL setting work. Allows for more natural syntax





PARAMETERS

-Path <String[]>

Changes the security descriptor of the specified item.

Enter the path to an item, such as a path to a file or registry key.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Rules <AccessRule[]>

Pre-set rule(s) that inherits from [System.Security.AccessControl.AccessRule].



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Principal <Object>

The user/group principal to be used.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Rights <Array>

The permission(s) the should be used.



Required? true

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PropagationFlags

Specifies how Access Control Entries (ACEs) are propagated to child objects. These flags are significant only

if inheritance flags are present.



Required? false

Position? named

Default value None

Accept pipeline input? false

Accept wildcard characters? false



-InheritanceFlags

Inheritance flags specify the semantics of inheritance for access control entries (ACEs).



Required? false

Position? named

Default value ContainerInherit, ObjectInherit

Accept pipeline input? false

Accept wildcard characters? false



-Inherit <Boolean>

Should the permission be viewed as inherited by child objects.



Required? false

Position? named

Default value True

Accept pipeline input? false

Accept wildcard characters? false



-Allow [<SwitchParameter>]

Represents an Allow permission.



Required? false

Position? named

Default value True

Accept pipeline input? false

Accept wildcard characters? false



-Deny [<SwitchParameter>]

Represents an Deny permission overrides -Allow.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



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



PS C:\\>Add-Acl -Path "c:\\temp" -Principal "UserName" -Rights "Read"



Update Folder ACL by username









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



PS C:\\>Add-Acl "HKCU:\\Test" $StrSID "ReadKey"



Update Registry ACL by username











RELATED LINKS