Created
January 17, 2021 21:17
-
-
Save gojimmypi/4ebce7c3072ec9942d8fa79f9bab9015 to your computer and use it in GitHub Desktop.
Take ownership and assign permissions in Windows
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
takeown /f "c:\files" /r | |
:: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-acl?view=powershell-7.1 | |
:: | |
:: get permissions from a sample file | |
$NewAcl = Get-Acl File0.txt | |
:: apply those permissions to other files | |
Get-ChildItem -Path "C:\files" -Recurse -Include "*.txt" -Force | Set-Acl -AclObject $NewAcl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment