Home folders multiple users

bj

Distinguished
Apr 14, 2004
125
0
18,680
Archived from groups: microsoft.public.win2000.active_directory (More info?)

Is there a way to batch create home folders for 1000 users at once?

TIA

Bobby
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

On Fri, 18 Mar 2005 12:22:52 GMT, "BJ" <bj@nomail.afraid.org> wrote:

>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