(---)
(---)
Line 1: Line 1:
-
<!--NewsZ Here is a simple .bat script tha creates multiple users without password, several users password protected, add a registry key to map the home directory of accounts to drive D, set static IP and DNS of workstations, set password of administrator account. This script is used to automate school laboratories configuration. EndZ-->
+
<!--NewsZ Here is a simple .bat script tha creates multiple users without password, several user account password protected, add a registry key to map the home directory of accounts to drive D, set static IP and DNS of workstations, set password of administrator account. This script is used to automate school laboratories configuration. EndZ-->
Here is a simple .bat script that:
Here is a simple .bat script that:
*creates multiple users, without password and with some restrictions as "no change password"
*creates multiple users, without password and with some restrictions as "no change password"
-
*creates several users, password protected
+
*creates several user account, password protected
*add a registry key to map the home directory of accounts to drive D:
*add a registry key to map the home directory of accounts to drive D:
*set static IP of workstations
*set static IP of workstations

Revision as of 22:29, 5 March 2014

Here is a simple .bat script that:

This script is used (and may be very useful to) to automate school laboratories configuration.

setup.bat

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
)
 
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 255.255.255.0 192.168.0.200 1
 
echo "Set DNS"
netsh interface ip add dns name="Local Area Connection" addr=8.8.8.8 index=1
netsh interface ip add dns name="Local Area Connection" addr=8.8.4.4 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
Retrieved from "http://www.zoros.org/wiki/index.php?title=A_simple_script_that_creates_multiple_Windows_user_accounts,_puts_home_directories_to_drive_D:,_rename_the_hostname_and_configure_LAN,_automatically."