Forum Discussion
craigbowens
Feb 17, 2022Copper Contributor
Script to change permissions on multiple folders
I am involved in a project to migrate users H: drive data to OneDrive. After we migrate their data to OneDrive, we want to change their H: drive folder and files to read-only. I have found a cacls ...
- Feb 18, 2022
craigbowens You could try something like using c:\temp\users.txt as input with a username per line. Not tested this, but I think it should work...
foreach ($user in get-content c:\temp\users.txt) { cacls.exe "k:\$($user)" /T /E /C /P "$($user):R" }
Feb 19, 2022
Did this work for you?
- craigbowensFeb 22, 2022Copper Contributor
Yes! Thank you very much!
- Feb 22, 2022Nice, please mark my answer as solution to mark it as solved
- --karthikFeb 12, 2023Copper Contributor
Hello - Thanks for that script as I was looking for the same. It worked. Can we have the same with icacls instead of cacls?
Can you also add a script that can give modify access only to one particular subfolder pls? subfolder name is the same for all users.