Skip to content

Instantly share code, notes, and snippets.

@p0w3rsh3ll
Created June 11, 2022 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p0w3rsh3ll/ce24635c5457d005ca79937c41ff0786 to your computer and use it in GitHub Desktop.
Save p0w3rsh3ll/ce24635c5457d005ca79937c41ff0786 to your computer and use it in GitHub Desktop.
# Set a Deny of user on .pdf key
$acl = Get-Acl -Path $extRegKeyPath
$rule = New-Object System.Security.AccessControl.RegistryAccessRule (
$user,
([System.Security.AccessControl.RegistryRights]::CreateSubKey+[System.Security.AccessControl.RegistryRights]::ChangePermissions),
[System.Security.AccessControl.AccessControlType]::Deny
)
$null = $acl.AddAccessRule($rule)
Set-Acl -Path $acl.Path -AclObject $acl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment