Solved

Need a script to reset Windows home dir permissions

Posted on 2010-08-24
2
317 Views
Last Modified: 2012-05-10
We migrated users over to a new file server.  The folder permissions were lost in translation.  All users home directories are \\lincoln\students\%username%.  I'm in need of a script to take the folder name (username) and give them full control of the folder.  Any suggestions would be greatly appreciated.  Thanks!
0
Comment
Question by:jjacksonwl
2 Comments
 
LVL 84

Expert Comment

by:oBdA
ID: 33513195
Assuming Administrators and System already have access, save the script below somewhere on the new server as CorrectHomePerm.cmd or Whatever.cmd, and adjust the "HomeRoot" variable to point to the local path of the shared "students" folder (it's just way faster than over a share).
You can test it, it will currently only print the cacls commands it would normally run. To run it for real (try a test folder with some dummy user folders first), simply remove the capitalized ECHO in front of "cacls".

@echo off
setlocal
set HomeRoot=D:\students
for /d %%a in ("%HomeRoot%\*.*") do (
  echo Processing %%~nxa ...
  ECHO cacls.exe "%%a" /t /e /g "%UserDomain%\%%~nxa":F
)
pause

Open in new window

0
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 33513231
MS has something called Xcacls.vbs. This website gives more info, with examples and download link  http://support.microsoft.com/kb/825751

Perphaps a script to take the folder name and supply permissions for each user

0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question