How to re-apply Windows Server sharing permissions and NTFS permissions for home directories

To re-apply sharing permissions (Everyone, Full) and NTFS permissions on Windows Server home directories, you can use the following script:

dir /b D:\...\UsrHome\ > usrhomeslist.txt
for /F %j in (usrhomeslist.txt) do net share %j$="D:\...\UsrHome\%j" /CACHE:none /GRANT:everyone,FULL
for /F %j in (usrhomeslist.txt) do cacls "D:\...\UsrHome\%j" /t /e /g %j:C

Cacls

/t – “tree” Apply changes to current directory and all sub-directories.
/e – “edit” Edit existing permissions instead of replacing them.
/g – “grant” Grant specified permissions to user or group.  Permissions can be:

  • R (Read)
  • W (Write)
  • C (Change)
  • F (Full Control)

 

How to re-apply Windows Server sharing permissions and NTFS permissions for home directories was last modified: August 25th, 2016 by tabcom