REF: https://itluke.online/2018/02/02/how-to-reset-file-or-folder-permissions-with-powershell/
- Install NTFSSecurity, a Powershell module from Raimund Andree
- use
Get-ChildItem
with -Force option to include hidden files - restore the canonical format
- take ownership
- remove manually added permissions
- restore inheritance
Install-Module -Name NTFSSecurity
Get-ChildItem -Path C:\Temp -Recurse -Force | ForEach-Object -Process {$ACL = Get-Acl -Path $PSItem.FullName; Set-Acl-Path $PSItem.FullName -AclObject $ACL}
Get-ChildItem -Path C:\Temp -Recurse -Force | Set-NTFSOwner -Account 'Administrator'
Get-ChildItem -Path C:\Temp -Recurse -Force | Clear-NTFSAccess
Get-ChildItem -Path C:\Temp -Recurse -Force | Enable-NTFSAccessInheritance