Forum Discussion

craigbowens's avatar
craigbowens
Copper Contributor
Feb 17, 2022

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 ...
  • Harm_Veenstra's avatar
    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"
    }

     

Resources