By default, NTFS folder permission inheritance is enabled. But in some cases, the administrator needs to disable it. If you have a lot of folders with folder permission inheritance disabled, you can use the following PowerShell script to enable it.

Use this code to enable folder permission inheritance on a folder and all the subfolders.

$allFolders=Get-ChildItem -Path C:\MySource -Directory -Recurse
foreach ($Folder in $allFolders){
$Permission=get-acl -Path $Folder.FullName
$Permission.SetAccessRuleProtection($False,$true)
Set-Acl -Path $Folder.FullName -AclObject $Permission
}

You can refer to Microsoft Site to know the argument assigned with SetAccessRuleProtection

Hope this help

Looking for some other tip, share with me your challenge, and will do my best to help.

2.2/5 - (23 votes)