kieranbarnes Independent PHP, WordPress & CubeCart Programmer

Managing User Shares in Windows

Posted on January 8, 2010

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!


Related posts

  1. Synchronizing time on a Windows 2003 domain controller
    In a Windows domain environment its incredibly important that all clients & servers share the...
  2. Fixing cPanel File Permissions
    Sometimes users mess with their own file permissions that they no longer work. They will...
  3. Permanently mount a Windows share in Linux
    Sick of manually mounting a Windows share on Linux with "mount" for it to drop...
  4. [Snippet] Event ID 1056 Source Dhcp Server
    Got the error The DHCP service has detected that it is running on a DC...
  5. Installing Windows Server 2008 on PERC 4/DC
    Got an older server like a Dell PowerEdge 2850 or a 2900 that you want...

Posted by Kieran


Comments (1) Trackbacks (0)
  1. Thanks for sharing such a useful information. I am definitely going to consider it next time.


Leave a comment

(required)

No trackbacks yet.