JSI Tip 8648. How can I force users to have Full Control and ownership of their User Name folder and contents?


If you have a parent folder that has User Name sub-folder, and each user does not have Full Control and ownership of their own sub-folder, and its' contents, you can run UserFolderOwner.bat to force them to have Full Control and ownership.

UserFolderOwner.bat uses SubInACL to set ownership and CACLS to set Full Control permission.

The syntax for using UserFolderOwner.bat is:

UserFolderOwner ParentFolder

Where ParentFolder is the path to the parent folder.

UserFolderOwner.bat contains:

@echo off
if \{%1\}==\{\} @echo Syntax: UserFolderOwner FolderPath&goto :EOF
if not exist %1 @echo UserFolderOwner - %1 not found&goto :EOF
pushd %1
for /f "Tokens=*" %%a in ('dir %1 /b /AD') do (
 @echo y| cacls "%%a" /t /e /c /g "%UserDomain%\%%a":F 
 subinacl /subdirectories "%%a" /setowner="%UserDomain%\%%a"
 subinacl /subdirectories "%%a/*.*" /setowner="%UserDomain%\%%a"
)
popd



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish