Basandome en 2 scripts de Microsoft he hecho este pequeño script en vbscript. Es bastante autoexplicativo.
He numerado las lineas porque algunas son muy largas
Cita:
1 strComputer = "."
2 Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
3 Set colNetAdapters = objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
4 ip = Array("192.168.1.2")
5 mascara = Array("255.255.255.0")
6 gw = Array("192.168.1.1")
7 gwmetric = Array(1)
8 dns = Array("192.168.1.20", "212.145.4.98")
10 For Each objNetAdapter in colNetAdapters
11 errip = objNetAdapter.EnableStatic(ip, mascara)
12 errgw = objNetAdapter.SetGateways(gw, gwmetric)
13 errdns = objNetAdapter.SetDNSServerSearchOrder(dns)
14 Next
15 If (errip = 0) AND (errgw = 0) AND (errdns = 0) Then
16 WScript.Echo "IP, mascara, gateway y DNS asignados con exito"
17 Else
18 WScript.Echo "Ha ocurrido algun error"
19 End If
|
Guardalo con extension vbs, y ya podes cambiar los parametros de red con un simple doble click.
Obviamente tenes que cambiar las variables ip, mascara, gw y dns segun nuestra configuracion de red.
Salu2.
Colo