Skip to content

New‑NTFSAccessRule

raandree edited this page Sep 6, 2026 · 1 revision

SYNOPSIS

Creates a reusable NTFS access rule.

SYNTAX

New-NTFSAccessRule [-Account] <String[]> [-AccessRights] <Object> [[-AccessControlType] <AccessControlType>]
 [[-AppliesTo] <String>] [<CommonParameters>]

DESCRIPTION

Creates an in-memory access rule with an account, rights, allow or deny qualifier, and an Explorer-style inheritance scope. The returned rule can be inspected, exported, or passed to another module command.

EXAMPLES

EXAMPLE 1

New-NTFSAccessRule -Account 'CONTOSO\Analysts' -AccessRights Read -AppliesTo FilesOnly

Creates a read rule that is inherited by files below a directory.

PARAMETERS

-AccessControlType

Specifies whether the rule allows or denies the selected rights.

Type: AccessControlType
Parameter Sets: (All)
Aliases:
Accepted values: Allow, Deny

Required: False
Position: 3
Default value: Allow
Accept pipeline input: False
Accept wildcard characters: False

-AccessRights

The filesystem rights represented by the new access rule. A raw access mask is also accepted as a decimal number or a hexadecimal string, so bits the FileSystemRights enumeration cannot name, such as the generic rights, can be used.

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Account

The account name or SID to which the new access rule applies.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-AppliesTo

Specifies how the rule applies to a directory and its child files or directories using names that correspond to Windows Explorer.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: ThisFolderSubfoldersAndFiles
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

OUTPUTS

WindowsAccessControl.AccessRule

NOTES

RELATED LINKS

Home

Commands

DSC resources

Clone this wiki locally