#32765 - 2002-11-18 02:59 PM
Win9x: ok / WinNT: :(
|
French_Opposum
Fresh Scripter
Registered: 2002-11-15
Posts: 7
|
Hello,
I wrote this code:
code:
if @INWIN=2
goto "win9x"
else
goto "winnt"
endif
:win9x
if 0=exist("%windir%\ipchanged.tmp")
$bkey="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services"
$NewIP="255.255.0.0"
$c=0
$Reboot = 0
$KeyN = enumkey("$bkey\Class\NetTrans\",$c)
while @error = 0 $ip = ReadValue($bkey+"\Class\NetTrans\$KeyN","IPMask") if @error = 0 and $ip <> "255.255.0.0" $ = writevalue($bkey+"\Class\NetTrans\$KeyN","IPMask",$newip,"REG_SZ") $Reboot = 1 endif $c = $c +1 $KeyN = enumkey($bkey+"\Class\NetTrans\",$c) loop if $Reboot = 1 shell "%comspec% /c echo changed ip from 255.255.255.0 to 255.255.0.0 > %windir%\ipchanged.tmp" ? "System needs to be restarted to establish new settings." ? ? " Press any key to proceed..." get $ run "%windir%\RUNDLL32.EXE user.exe,ExitWindows" exit else shell "%comspec% /c echo no changes done > %windir%\ipchanged.tmp" endif endif
:winnt
MISSING PART
to change subnetmask both on Win9X & WinNT First part works perfectly, it is thanks to you.
But i don't know how to make change on Winnt stations (NT4sp6a & NT5) , users are admin on local.
if you have ideas, I listen to you
Thank you to understand poor debutant
|
|
Top
|
|
|
|
#32767 - 2002-11-18 04:27 PM
Re: Win9x: ok / WinNT: :(
|
French_Opposum
Fresh Scripter
Registered: 2002-11-15
Posts: 7
|
thx lonkero, but it seems not to work
so i wrote this; it works good:
code:
:winnt
if 0=exist("%windir%\ipchanged.tmp")
$bkey="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
$NewIP="255.255.0.0."
$c=0
$Reboot = 0
$KeyN = enumkey("$bkey\Interfaces\",$c)
while @error = 0 $ip = ReadValue($bkey+"\Interfaces\$KeyN","SubnetMask") if @error = 0 and $ip <> "0.0.0.0" $ = writevalue($bkey+"\Interfaces\$KeyN","SubnetMask",$newIP,"REG_MULTI_SZ") $Reboot = 1 endif $c = $c +1 $KeyN = enumkey($bkey+"\Interfaces\",$c) loop if $Reboot = 1 shell "%comspec% /c echo changed ip from 255.255.255.0 to 255.255.0.0 > %windir%\ipchanged.tmp" ? "SubnetMask Changed" ? ? " Press any key to quit..." get $ SHUTDOWN ("","Redemarrage",5,1,1) else shell "%comspec% /c echo no changes done > %windir%\ipchanged.tmp" endif endif
|
|
Top
|
|
|
|
#32768 - 2002-11-18 04:32 PM
Re: Win9x: ok / WinNT: :(
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
You should explore WriteLog() & WriteLog2() in the UDF library.
See this link: Kixtart.org UDF library collection
They will simplify you logging.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|