J Jerold Schulman Mar 18, 2005 #2 Is there a way to batch create home folders for 1000 users at once? TIA Bobby Click to expand... 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
Is there a way to batch create home folders for 1000 users at once? TIA Bobby Click to expand... 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