Answer the question
In order to leave comments, you need to log in
How does assignment work in powershell?
Why when executing:
$crdir="C:\temp"
$acl = Get-Acl $crdir
$newacl=$acl
$newacl.SetAccessRuleProtection($True, $false)
$acl |ft -Wrap
$newacl |ft -Wrap
Answer the question
In order to leave comments, you need to log in
Answered elsewhere.
For those interested, this is a reference data type.
The .SetAccessRuleProtection method performs two actions, the first - blocks inheritance of permissions from the parent / enables inheritance for the object, the second - leaves inherited permissions as explicitly set permissions / removes inherited permissions and leaves only those that were explicitly set.
Thus, most likely you simply do not have any inherited permissions for the folder "C:\temp" If you for example create a subfolder in "C:\temp", give the folder "C:\temp" permissions and enable inheritance, then after execution $newacl.SetAccessRuleProtection($True, $false) when applied to a folder inside "C:\temp" the output between $acl and $newacl will be different because permission inheritance will be removed.
You can read more herehttps://windowsnotes.ru/powershell-2/upravlenie-ac...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question