If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.
We are using the following shared subnet script, but it only works for one subnet, not two. In other words, we cannot get this script to run two instances in the same batch file. It only runs the first instance, and bombs out at the second instance. Here is the script: rem ***Login Script for Location1 and Location2*** @Echo off set subnettocheck=10.60.26 ipconfig | find "%subnettocheck%" | find "IP Address" > %temp%\Ipaddr.txt for /f "tokens=*" %%a in (%temp%\ipaddr.txt) do set ipaddr=%%a & goto :next :next Rem Get end of string. replace . . . with nothing set ipaddr=%ipaddr:. =% REM Remove IP Address: set ipaddr=%ipaddr:IP Address:=% REM Remove any spaces to leave IP address x.x.x.x set ipaddr=%ipaddr: =% set lastoctet=%ipaddr:~-3,3% set subnet=%ipaddr:~0,-4% if "%lastoctet:~0,1%"=="." set lastoctet=%lastoctet:~1% & set subnet=%ipaddr:~0,-3% if "%lastoctet:~1,1%"=="." set lastoctet=%lastoctet:~2% & set subnet=%ipaddr:~0,-2% echo Your IP address is %ipaddr% echo Your subnet is %subnet% echo Last octet is %lastoctet% if %lastoctet% LSS 63 echo Less than 63 & goto subnet63 if %lastoctet% LSS 127 echo Less than 127 & goto subnet127 :subnet63 rem ***Location1*** net use l: \\server1\APPS net use m: \\server1\DATA net use S: \\main\data net use t: \\main\apps goto next :subnet127 rem ***Location2*** net use S: \\server2\data goto next :next
Join the community of 500,000 technology professionals and ask your questions.