Here is a short script for adding home directories for a user. You can use it in two different ways:
1. Interactive
homedir.bat username
2. Batch
homedir.bat -file userfile.txt
Format for import file (userfile.txt):
user1
user2
.
.
======================= START SCRIPT ===========================
@ECHO OFF
if “%1″==”-file” GOTO FILE
GOTO ADDHOMEDIR
:FILE
if “%2″==”” GOTO NOFILE
Echo Reading from users from %2…
for /f “tokens=*” %%a in (%2) do call :ADDHOMEDIR %%a
goto :EXIT
GOTO EXIT
:ADDHOMEDIR
IF NOT EXIST d:users%1 md d:users%1
cacls d:users%1 /E /T /C /G “DOMAIN%1”:F “DOMAINDomain Admins”:F
chown -r -v -d DOMAIN %1 d:users%1*
GOTO EXIT
:ERROR
echo Folder already exists…
GOTO EXIT
:NOFILE
echo Filename missing…
GOTO EXIT
:EXIT
======================= END SCRIPT ===========================