[VBS]Modifier les paramètres réseau local
Bonjours à tous !
Voilà j'expose mon problème : je fais souvent des lans et modifier à chaque fois les paramètres réseaux m'embêtais j'ai alors penser à faire un script.
Le voici :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| strIP1 = inputbox("Veuillez entre l'adresse IP "& chr(13) & "(Format : "&chr(34)&"192.168.1.141"&chr(34)&")", "IP?")
strmask1 = InputBox ("Veuillez entrer le masque de sous réseau"& chr(13) & "(Format : "&chr(34)&"255.255.255.0"&chr(34)&")", "Mask?")
strIP = Array(strIP1)
strmask = Array(strmask1)
strGateway = Array("")
strGatewayMetric = Array(1)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIP, strmask)
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 |
Mon soucis est qu'il change les paramètres réseaux du réseaux wifi et je veux modifier seulement les paramètres réseaux local.
Déjà est-il possible de le faire ? Si oui un peu d'aide serai la bienvenue.
Je souhaite maintenir le vbs car j'utilise déjà un script sur ma machine.
Merci d'avance.