Created
April 11, 2023 20:33
-
-
Save simonLeary42/00a490b50310a52a65e76503c69a4070 to your computer and use it in GitHub Desktop.
powershell equivalent to `chmod -w`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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