Home folders multiple users

  • Thread starter Thread starter BJ
  • Start date Start date
Is there a way to batch create home folders for 1000 users at once?

TIA

Bobby
See tip 6820, 7714, and 7992 in the 'Tips & Tricks' at http://www.jsiinc.com

From a Windows XP domain member or Windows Server 2003, you could run the following to set a roaming profile on all users that don't have one:

@echo off
setlocal
for /f "Tokens=1*" %%a in ('dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User))" -attr distinguishedName sAMAccountName homeDirectory -L -LIMIT 0') do (
if /i "%%a" EQU "homeDirectory:" if "%%b" EQU "" call :doit
if /i "%%a" EQU "distinguishedName:" set dn=%%b
if /i "%%a" EQU "sAMAccountName:" set samid=%%b
)
endlocal
goto :EOF
:doit
@echo dsmod user "%dn%" -hmdir \\ServerName\Users\%samid% -hmdrv H:
dsmod user "%dn%" -hmdir \\ServerName\Users\%samid% -hmdrv H:
@echo.

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
 
Back
Top