Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save simonLeary42/00a490b50310a52a65e76503c69a4070 to your computer and use it in GitHub Desktop.

Select an option

Save simonLeary42/00a490b50310a52a65e76503c69a4070 to your computer and use it in GitHub Desktop.
powershell equivalent to `chmod -w`
function Remove-Write-Privs{
param([string]$filename)
$acl = Get-Acl $filename
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule("Users", "Write", "Deny")
$acl.AddAccessRule($rule)
Set-Acl $filename $acl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment