TestimoX

API Reference

Command

Set-CxFilePermissions

Namespace ComputerX.PowerShell
Inputs
System.String
Outputs
System.Boolean

Sets file or directory permissions (DACL).

Examples

Authored help example

Example 1


# Replace with SDDL
Set-CxFilePermissions -Path 'C:\\Data' -Sddl 'D:(A;;FA;;;S-1-5-32-544)'
        

Example 2


# Merge typed entries into existing DACL
$e = [ComputerX.Acl.FileAclEntry]@{ IdentityName='BUILTIN\\Users'; Rights=[System.Security.AccessControl.FileSystemRights]::ReadAndExecute; AccessType='Allow' }
Set-CxFilePermissions -Path 'C:\\Data' -Entries $e -Ensure Merge
        

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

Set-CxFilePermissions -Path <string> -Sddl <string> [-Ensure <Replace|Merge>] [<CommonParameters>]
#
Parameter set: By Sddl

Parameters

Path string requiredposition: 0pipeline: true (ByPropertyName)
File system path to the target resource.
Sddl string requiredposition: namedpipeline: false
Gets or sets the Sddl parameter.
Ensure EnsureMode optionalposition: namedpipeline: falsevalues: 2
Gets or sets the Ensure parameter. Possible values: Replace, Merge
Possible values: Replace, Merge

Outputs

System.Boolean

Set-CxFilePermissions -Path <string> -Entries <FileAclEntry[]> [-Ensure <Replace|Merge>] [<CommonParameters>]
#
Parameter set: By Entries

Parameters

Path string requiredposition: 0pipeline: true (ByPropertyName)
File system path to the target resource.
Entries FileAclEntry[] requiredposition: namedpipeline: false
Typed ACL entries to apply when not supplying SDDL.
Ensure EnsureMode optionalposition: namedpipeline: falsevalues: 2
Gets or sets the Ensure parameter. Possible values: Replace, Merge
Possible values: Replace, Merge

Outputs

System.Boolean