bonjour, je cherche un script pour changer l'ip d'une carte reseau (sachant que je suis sous XP et que l'ordinateur possede 2 cartes reseaux).
J'ai trouvé le code suivant mais ca donne la meme adresse a toutes les cartes reseaux :
Pourriez vous m'aider, d'avance merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 trComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2" ) Set colNetAdapters = objWMIService.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE" ) strIPAddress = Array("192.168.1.141" ) strSubnetMask = Array("255.255.255.0" ) strGateway = Array("192.168.1.100" ) strGatewayMetric = Array(1) For Each objNetAdapter in colNetAdapters errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask) errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric) If errEnable = 0 Then WScript.Echo "The IP address has been changed." Else WScript.Echo "The IP address could not be changed." End If Next
Partager