Files
Powershell-Scripts/Test Scripts/Get ACLs(needs modifying).ps1
T
2025-08-05 15:12:49 +00:00

15 lines
578 B
PowerShell

Get-ChildItem "C:\" -Directory -Recurse -Depth 1 | get-acl | Where {-NOT $_.AreAccessRulesProtected} |
Select @{Name="Path";Expression={Convert-Path $_.Path}},AreAccessRulesProtected |
format-table -AutoSize |
#Out-File "C:\Temp\ACL.csv" -Force
$acl = get-acl c:\work\demo2
$acl.SetAccessRuleProtection.OverloadDefinitions
$acl.SetAccessRuleProtection($False,$True)
set-acl -Path c:\work\demo2 -AclObject $acl
dir c:\work -Directory -recurse | get-acl | Where {$_.AreAccessRulesProtected} | set-inheritance -whatif
Set-Inheritance C:\work\demo1 -NoInherit