Managing User Shares in Windows

So you’ve probably got a Users folder with directories in matching all your Windows users, so they all have a private “home” drive on your server?

Ever tried to manage permissions on them, or messed permissions up? Or managed to make your Director’s files world-readable?This batch file will reset ALL the file and folder permissions on the user home directories on the server.
It will remove all current permissions and set the following permissions – (Domain Admins-Full, Administrators-Full, SYSTEM-Full, and USER-Full).

Change the default scripting engine from Wscript to Cscript. (The Xcacls.vbs script works best in Cscript.) To do this, type the following at a command prompt, and type cscript.exe /h:cscript

Save the code below as “Set Home Directory Permissions.bat” and download XACLS onto the server
http://support.microsoft.com/default.aspx/kb/825751
@ECHO OFF
CLS
ECHO This batch file can be run from any Workstation with XCALCS on it ECHO.
ECHO This batch file will reset ALL the file and folder permissions on ECHO the Server.
ECHO It will remove all current permissions and set the following permissions ECHO (Domain Admins-Full, Administrators-Full, SYSTEM-Full, and USER-Full) ECHO.
ECHO WARNING РWARNING   This is an irreversible action.
ECHO.
ECHO.
ECHO Press CTRL-C now to quit this batch file.
ECHO Otherwise press any key to continue…
PAUSE >nul
for /f “Tokens=*” %%i in (‘dir /B <YOUR DRIVE>:\<YOUR PATH>’) do xcacls <YOUR DRIVE>:\<YOUR PATH>\%%i /T /P “<YOUR DOMAIN>\DOMAIN ADMINS”:F;F Administrators:F;F SYSTEM:F;F <YOUR DOMAIN>\%%i:F;F
Done!

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

One thought on “Managing User Shares in Windows”

  1. Thanks for sharing such a useful information. I am definitely going to consider it next time.

Leave a Reply

Your email address will not be published. Required fields are marked *