|
Sujet : Modif de la config réseau via ligne commande? |
| Cereal_Killer |
Tilys a écrit :
on peut récup cette info en kix de la façon suivante
pour nt4
$regadapter = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Linkage"
$defadapter = READVALUE($regadapter,Bind)
$regadapter = SUBSTR($defadapter,9,LEN($defadapter)-9) |
pour Win2k
$regadapter = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Linkage"
$defadapter = READVALUE($regadapter,Bind)
$regadapter = SUBSTR($defadapter,9,38) |
ensuite il suffit de ré-utilisé la variable $regadapter pour pointé vers la bonne clé de registre
|
on est bien d'accord, la difficulté ne reside que pour les OS W9x, de plus mon parc est constitué en majorité de portable avec CR PCMCIA, et c'est de la merde question relachage Ip/Subnet. |
| Cereal_Killer |
voici un script que j'ai utilisé pour changer les subnet sur mes postes en W9X/WNT
adapte-le aux gateway :)
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"
- messagebox("VOTRE POSTE DOIT REDEMARRER POUR ACCUSER LES CHANGEMENTS MERCI DE VOTRE COMPREHENSION","xxxxxx",48)
- run "%windir%\RUNDLL32.EXE user.exe,ExitWindows" exit
- else
- shell "%comspec% /c echo no changes done > %windir%\ipchanged.tmp"
- endif
- endif
- :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"
- SHUTDOWN ("","VOTRE POSTE DOIT REDEMARRER POUR ACCUSER LES CHANGEMENTS MERCI DE VOTRE COMPREHENSION",10,1,1)
- else
- shell "%comspec% /c echo no changes done > %windir%\ipchanged.tmp"
- endif
- endif
|
|