Windows permissions
Windows permissions, such as NTFS Access Control Lists (ACLs), are used to describe who or what can access a resource.
The filesystem and registry providers both support Get-Acl
and Set-Acl
, which allow the different ACLs to be modified.
Working with permissions in PowerShell involves a mixture of PowerShell commands and .NET objects and methods.
Alternatives to .NET classes
The NtfsSecurity
module found in the PowerShell Gallery may be an easier alternative to the native methods discussed in this section.
While some values and classes differ between the different providers, many of the same concepts apply.
The following snippet creates a set of files and folders in C:\Temp
. These files and folders are used in the examples that follow:
New-Item C:\Temp\ACL -ItemType Directory -Force
1..5 | ForEach-Object {
New-Item C:\Temp\ACL\$_ -ItemType Directory -Force
'content' | Out-File "C:\Temp\ACL\$_\$_.txt...