Here is a simple .bat script that:

This script is used (and may be very useful to) to automate school laboratories configuration. Note: rev.01 - add some "wmic useraccount" commands to lock password expiration


echo off
if  "%1" == "" (
echo "Usage: %0 N_PC_to_configure" 
exit /b
echo "Set user profile to D:\Users"
mkdir d:\Users
icacls "D:\Users" /grant everyone:(OI)(CI)F
reg add  "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v ProfilesDirectory /t REG_EXPAND_SZ /d "D:\Users" /f
echo "Make Classes/Students accounts"
for %%x in (1A 1B 2A 2B ... 3A 4A 5A) do (
echo "Make user: %%x"
net user %%x /passwordreq:no /active:yes /comment:"Class %%x" /expires:never /fullname:"Class %%x" /passwordchg:no /homedir:D:\Users\%%x /add
wmic useraccount where "name='%%x'" set PasswordExpires=FALSE
wmic useraccount where "name='%%x'" set disabled=FALSE
echo "Make Teachers protected accounts"
net user Teacher1 pwteacher1 /passwordreq:yes /active:yes /expires:never /fullname:"Teacher 1" /passwordchg:yes /homedir:D:\Users\teacher1 /add
net user Teacher2 pwteacher2 /passwordreq:yes /active:yes /expires:never /fullname:"Teacher 2" /passwordchg:yes /homedir:D:\Users\teacher2 /add
net user Teacher3 pwteacher3 /passwordreq:yes /active:yes /expires:never /fullname:"Teacher 3" /passwordchg:yes /homedir:D:\Users\teacher3 /add
echo "Set IP to %1"
netsh interface ip set address "Local Area Connection" static 192.168.0.%1 1
echo "Set DNS"
netsh interface ip add dns name="Local Area Connection" addr= index=1
netsh interface ip add dns name="Local Area Connection" addr= index=2
echo "Rename Hostname to LPE-PC-%1"
wmic computersystem where name="Master-PC" call rename name="LPE-PC-%1"
echo "Set Master password (Master is an administrator)"
net user Master abcd1234

Tested on Windows 7 Professional 32 bit. Use at own risk!

Retrieved from ",_puts_home_directories_to_drive_D:,_rename_the_hostname_and_configure_LAN,_automatically."