seleccionar ip automatica propiedades protocolo conexion red

Iniciado por ELGRANSOLRAC, 31 Enero 2009, 23:42 PM

0 Miembros y 1 Visitante están viendo este tema.

ELGRANSOLRAC

Hola,
Me gustaria saber si alguien tiene algo de idea sobre este tema.
Tengo un codigo que que asigna una IP en manual.
Mi pregunta es como volver a poner el "obtener direccion IP automaticamente"
mediante codigo.Este es el codigo:



strComputer = "."
Set objWMIService = CreateObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array(Text1.Text)
strSubnetMask = Array(Text2.Text)
strGateway = Array(Text3.Text)
strGatewaymetric = Array(1)
Started = True
StartMode = "Automatic"
For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
If errEnable = 0 Then
MsgBox "¡La IP se ha cambiado correctamente!"
Else
MsgBox "¡La IP no se ha podido cambiar!"
End If
Next



Este codigo pone la ip y mascara en manual, como ponerla en automatico?
Gracias