tjohnson4
(chillyw13)
March 13, 2018, 2:41pm
1
I have a script that sets permissions on my newly created folders. One thing I am finding is that it is turning off inheritable permissions. I have tried to set this, but nothing seems to work. This is what I am referring to:
As you can see, it is not enabled after running my script. So, I tried writing a new script to change it. No dice. here is my code:
foreach($_ in (Get-ChildItem "C:\SHARES\folder\docs" -recurse)){
if($_.name -eq "docs"){
$inheritance = Get-Acl -path $_.fullname
$inheritance.SetAccessRuleProtection($true,$true)
set-acl -path $_.fullname -aclobject $inheritance
}}
Any suggestions to fix this?
4 Spice ups
psophos
(M Boyle)
March 13, 2018, 2:56pm
2
2 Spice ups
tjohnson4
(chillyw13)
March 13, 2018, 3:03pm
3
I’m an idiot. I had my folder path set wrong this whole time!
jitensh
(JitenSh)
March 13, 2018, 3:08pm
4
I would simply use 1 liner
icacls C:\scripts /inheritance:E
1 Spice up