The permissions for the default directory are inherited from the parent directory, and you can of course turn off its inheritance and assign the specified permissions.
The following example creates a "permissionnoinheritance" folder that allows the current user to read, while the Administrators group obtains all of its administrative rights and closes its inheritance.
# Create folder
$Path = ' c:\PermissionNoInheritance '
$null = New-item-path $Path-itemtype directory-erroractio n silentlycontinue
# Get current permissions
$acl = Get-acl-path $path
# Add a new permission for R
$permission = $env: Username, ' read,modify ', ' Containerinherit, Objectinherit ', ' None ', ' Allow '
$rule = New-object-typename system.security.accesscontrol.filesystemaccessrule-argumentlist $permission
$acl. Setaccessrule ($rule)
# Add a new permission for Administrators
$permission = ' Administrators ', ' FullControl ', ' Containerinherit, Objectinherit ', ' None ', ' Allow '
$rule = new-object-typename System.security.accesscontrol.filesystemaccessrule-argumentlist $permission
$acl. Setaccessrule ($rule)
# Disable inheritance
$acl. Setaccessruleprotection ($true, $false)
# Set new Permissions
$acl | Set-acl-path $path