QUOTE (Dee @ May 12 2004, 02:08 PM)
I use COMPNAME (search for it on
Simtel.net). Because there is a very small chance that the random name generated with this program will be a duplicate of another I simply run net start a few times, running COMPNAME in between each attempt.
CODE
REM ==============================================================
REM Attempt to connect to the network 5 times. Generate a new
REM random name each time in case we conflict with someone else.
REM Wait longer and longer each time we try.
REM ==============================================================
REM 111111111111111111111111111111
ewc #V#=0B - First attempt ...#=07
COMPNAME.EXE > NUL
GSAR.EXE -f "-s**COMPUTERNAME**" "-r%COMPNAME%" %RAMDRIVE%\LANMAN\SYSTEM.TMP %RAMDRIVE%\LANMAN\SYSTEM.INI > NUL
NET START > NUL
if errorlevel 1 goto logon
REM 222222222222222222222222222222
ewc #=0B - Second attempt ...#=07#+1+
COMPNAME.EXE > NUL
GSAR.EXE -f "-s**COMPUTERNAME**" "-r%COMPNAME%" %RAMDRIVE%\LANMAN\SYSTEM.TMP %RAMDRIVE%\LANMAN\SYSTEM.INI > NUL
NET START > NUL
if errorlevel 1 goto logon
REM 333333333333333333333333333333
ewc #=0B - Third attempt ...#=07#+3+
COMPNAME.EXE > NUL
GSAR.EXE -f "-s**COMPUTERNAME**" "-r%COMPNAME%" %RAMDRIVE%\LANMAN\SYSTEM.TMP %RAMDRIVE%\LANMAN\SYSTEM.INI > NUL
NET START > NUL
if errorlevel 1 goto logon
REM 444444444444444444444444444444
ewc #=0B - Fourth attempt ...#=07#+5+
COMPNAME.EXE > NUL
GSAR.EXE -f "-s**COMPUTERNAME**" "-r%COMPNAME%" %RAMDRIVE%\LANMAN\SYSTEM.TMP %RAMDRIVE%\LANMAN\SYSTEM.INI > NUL
NET START > NUL
if errorlevel 1 goto logon
REM 555555555555555555555555555555
ewc #=0B - Fifth attempt ...#=07#+7+
COMPNAME.EXE > NUL
GSAR.EXE -f "-s**COMPUTERNAME**" "-r%COMPNAME%" %RAMDRIVE%\LANMAN\SYSTEM.TMP %RAMDRIVE%\LANMAN\SYSTEM.INI > NUL
NET START > NUL
if errorlevel 1 goto logon
goto netError
Notes:"ewc" is used for visual formatting and for inserting an increasing delay in seconds between attempts. Can be found on
Simtel.net.
"gsar" is used to search and replace text in text files, in this case my system.ini file. Can be found on
SourceForge.
The DOS version of net start actually initializes networking, unlike the Windows version which lists running services.
The example above jumps to the "logon" label if an attempt is successful, otherwise it retries a number of times before finally failing and jumping to the "netError" label.
This method hasn't failed yet on the (literally) thousands of times it's been used by myself or my co-workers.
Hi there, i really like this script if only i could get it to work.
When i run the script i get an error can not bind twice in static mode
I will post a copy of my autoexec.bat & system.ini can you tell me if they are right
AUTOEXEC.BAT
@ECHO OFF
SET TZ=GHO+00:00
SET PATH=a:\net;a:\;
cd \net
CALL \NET\DOIT.BAT
REM ==============================================================
REM Attempt to connect to the network 5 times. Generate a new
REM random name each time in case we conflict with someone else.
REM Wait longer and longer each time we try.
REM ==============================================================
REM 111111111111111111111111111111
a:\net\ewc #V#=0B - First attempt ...#=07
a:\net\COMPNAME.EXE > NUL
GSAR.EXE -f "-s**COMPUTERNAME**" "-r%COMPNAME%" A:\NET\SYSTEM.TMP A:\NET\SYSTEM.INI > NUL
NET START > NUL
if errorlevel 1 goto logon
REM 222222222222222222222222222222
ewc #=0B - Second attempt ...#=07#+1+
COMPNAME.EXE > NUL
GSAR.EXE -f "-s**COMPUTERNAME**" "-r%COMPNAME%" A:\NET\SYSTEM.TMP A:\NET\SYSTEM.INI > NUL
NET START > NUL
if errorlevel 1 goto logon
REM 333333333333333333333333333333
ewc #=0B - Third attempt ...#=07#+3+
COMPNAME.EXE > NUL
GSAR.EXE -f "-s**COMPUTERNAME**" "-r%COMPNAME%" A:\NET\SYSTEM.TMP A:\NET\SYSTEM.INI > NUL
NET START > NUL
if errorlevel 1 goto logon
REM 444444444444444444444444444444
ewc #=0B - Fourth attempt ...#=07#+5+
COMPNAME.EXE > NUL
GSAR.EXE -f "-s**COMPUTERNAME**" "-r%COMPNAME%" A:\NET\SYSTEM.TMP A:\NET\SYSTEM.INI > NUL
NET START > NUL
if errorlevel 1 goto logon
REM 555555555555555555555555555555
ewc #=0B - Fifth attempt ...#=07#+7+
COMPNAME.EXE > NUL
GSAR.EXE -f "-s**COMPUTERNAME**" "-r%COMPNAME%" A:\NET\SYSTEM.TMP A:\NET\SYSTEM.INI > NUL
NET START > NUL
if errorlevel 1 goto logon
goto netError
:logon
a:\net\netbind.com
a:\net\umb.com
a:\net\tcptsr.exe
a:\net\tinyrfc.exe
a:\net\nmtsr.exe
a:\net\emsbfr.exe
a:\net\net start
A:\NET\NET.EXE USE G: \\ghost\ghost
A:\NET\NET.EXE USE
SYSTEM.INI
[network]
filesharing=no
printsharing=no
autologon=yes
computername=homer
lanroot=a:\net
username=ghost
workgroup=london
reconnect=no
dospophotkey=N
lmlogon=0
logondomain=london
prefferedredir=full
autostart=full
maxconnections=8
[network drivers]
netcard=
transport=tcpdrv.dos,nemm.dos
devdir=a:\net
LoadRMDrivers=yes
[Password Lists]
*Shares=A:\NET\Shares.PW
I really need to get this DOS boot disk to change the computer name each time and your script id the closeest i have seen to doing it.
Can you help me out at all?