10 February, 2010

New User Home directory auto-creation

Hi,

New users always come and you do the same things a lot of times.
I wrote a script to simplify the creation and permissions of new user directories.

Just multiply the script for any new personal directory (this one include 2 directories):
=================================================================
echo off
cls
echo This batch will create and set ACL on PST and home Drive
echo.
echo Please type the new user name:
set /P C=

if exist \\server1\pst$\%C% goto pst_exist
echo The pst folder will be created
pause
echo.
md \\server1\pst$\%C%
cacls \\server1\pst$\%C% /E /G "%C%":C
goto check_Homefolder

:pst_exist
echo the PST directory already exist, please check
pause
echo.

:check_Homefolder
if exist \\server2\users\%C% goto H_exist
echo The Home Folder folder will be created
pause
echo.
md \\server2\users\%C%
cacls \\server2\users\%C% /E /G "%C%":C
goto end

:H_exist
echo the Home Folder directory already exist, please check


:end
pause

=========================================================

No comments:

Post a Comment