Answer the question
In order to leave comments, you need to log in
How to use Set-acl in a loop?
I need to copy the permissions of one directory to several others, all directories are in one place.
I am in powershell=0. At the moment, this is what I have:
//save permissions to a variable.
$acl = Get-acl 'd:\obm\Lastname Firstname'
// that's all.
And how to apply Set-acl further in a cycle (for example foreach) that would go through all the directories in 'd:\obm' and assign permissions from $acl.
Answer the question
In order to leave comments, you need to log in
Get-ChildItem d:\obm -Recurse -Directory | forEach { set-acl -path $_.FullName -aclObj $acl }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question