Search notes:

Powershell command noun: acl

The PowerShell cmdlet-noun acl can be used to manipulate security descriptors of certain items (files, directories, registry keys).
Commands related to the PowerShell command noun acl:

Adding a rule

The following simple example tries to demonstrate how a combination of get-acl and set-acl can be used to add an identity to the set of users that are allowed access to a directory:
#
#  Create a dummy directory to test on it:
#
$null = new-item -itemType directory foo

#
#  Get the directory's access control list
#
$acl = get-acl foo

#
# The following would show the access list
#
# $acl.Access

#
#  Create a new rule to grant (allow) FullControl to NT SERVICE\MSSQLSERVER:
#

$ident = new-object System.Security.Principal.NTAccount 'NT SERVICE\MSSQLSERVER'

$rule = new-object System.Security.AccessControl.FileSystemAccessRule      `
    $ident                                                               , `
   ([type]'System.Security.AccessControl.FileSystemRights' )::FullControl, `
   ([type]'System.Security.AccessControl.AccessControlType')::Allow  `

$acl.AddAccessRule($rule)

set-acl foo $acl

# remove-item foo
Github repository about-PowerShell, path: /cmdlets/acl/add-rule.ps1

See also

cacls.exe, icacls.exe
Powershell command nouns

Links

Helge Klein's command line utility SetACL.exe.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1745354699, '18.224.21.26', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/command-inventory/noun/acl/index(86): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78