Feb 17 2022 11:55 AM
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 command to change the permissions (CACLS K:\foldername /T /E /C /P username:R) but I need to do this for specific user's H: drives. o I need the script to read from a txt file to perform the cacls command on each of the folders in the txt file. Is there a smart person out there that can help?
Feb 18 2022 01:39 AM
Solution@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 22 2022 05:59 AM
Yes! Thank you very much!
Feb 22 2022 06:11 AM