Salut,
Alors il y a plusieurs facon de modifier son adresse ip ainsi que ca passerelle.
1) Utiliser la commande dos (netsh)
Fait un netsh /? pour avoir de l'aide
2) Utiliser le WMI :
Set cards = GetObject("winmgmts: impersonationLevel=impersonate}").ExecQuery("select * from Win32_networkAdapterconfiguration") myip = Array("192.168.1.2") mynet = Array("255.255.255.0") mygateway= array ("192.168.1.1") mygatewaymetric= array (1) card.setgateways mygateway,mygatewaymetric
for each card in cards retour=card.enablestatic myip, mynet retour2=card.setgateways mygateway,mygatewaymetric if retour = 0 then msgbox "Changement d'adresse effectué." else msgbox "le changement n'a pas pu se faire." end if if retour2 = 0 then msgbox "Changement de passerelle effectué." else msgbox "le changement n'a pas pu se faire." end if next
|
myip = adresseip
mynet = masque de réseau
mygateway = ta passerelle
Personnelement je te conseil d'utiliser la 2eme méthode
@++
________________
TheEwook