Soldato
- Joined
- 18 May 2010
- Posts
- 23,292
- Location
- London
This is my weakness. My scripting skills.
We have a problem with our cloud backup solution in that it is giving us errors because the permissions on the Users directory on our DC are corrupt.
The users folders and files have lost their ownership. So we as domain admins cannot browse the directories or set any permissions through the GUI.
I'm trying to fix this and found a script that supposedly can do it:
REM usage: fix_perms.bat <username>
REM Recursively assign ownership to Administrators. Answer prompts with "Y".
takeown /R /A /F %1 /D Y
REM Grant Full permissions on folder and subfolders to Administrators, SYSTEM, and the user
cacls %1 /T /E /P "Administrators":F
cacls %1 /T /E /P SYSTEM:F
cacls %1 /T /E /P %1:F
REM Set owner back to UserName
subinacl.exe /noverbose /subdirectories %1\*.* /setowner=%1
It more or less works expect subinacl.exe doesn't work as we are running a x64 Windows Server and as far as I understand subinacl.exe is a 32 bit command line tool. (I've tried installing it in to system32 already)
So, my manager has recommended I look at icacls to get the job done.
Anyone give me some pointers how to do what the subinacl is trying to do using icacls?
We have a problem with our cloud backup solution in that it is giving us errors because the permissions on the Users directory on our DC are corrupt.
The users folders and files have lost their ownership. So we as domain admins cannot browse the directories or set any permissions through the GUI.
I'm trying to fix this and found a script that supposedly can do it:
REM usage: fix_perms.bat <username>
REM Recursively assign ownership to Administrators. Answer prompts with "Y".
takeown /R /A /F %1 /D Y
REM Grant Full permissions on folder and subfolders to Administrators, SYSTEM, and the user
cacls %1 /T /E /P "Administrators":F
cacls %1 /T /E /P SYSTEM:F
cacls %1 /T /E /P %1:F
REM Set owner back to UserName
subinacl.exe /noverbose /subdirectories %1\*.* /setowner=%1
It more or less works expect subinacl.exe doesn't work as we are running a x64 Windows Server and as far as I understand subinacl.exe is a 32 bit command line tool. (I've tried installing it in to system32 already)
So, my manager has recommended I look at icacls to get the job done.
Anyone give me some pointers how to do what the subinacl is trying to do using icacls?