Hello,
I am using a script that changes my laptop's network card properties from DHCP to a fixed IP address, with 2 DNS servers.
I have another script that changes it back to DHCP.
But I want the card to "obtain the DNS server address automatically" too.
What do i need to use to do this?
Hope someone can help.
Many thanks
T
The code I have for bringing the card back to using DHCP is:
**************
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableDHCP()
If errEnable = 0 Then
Wscript.Echo "DHCP has been enabled."
Else
Wscript.Echo "DHCP could not be enabled."
End If
Next
**************
I am using a script that changes my laptop's network card properties from DHCP to a fixed IP address, with 2 DNS servers.
I have another script that changes it back to DHCP.
But I want the card to "obtain the DNS server address automatically" too.
What do i need to use to do this?
Hope someone can help.
Many thanks
T
The code I have for bringing the card back to using DHCP is:
**************
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableDHCP()
If errEnable = 0 Then
Wscript.Echo "DHCP has been enabled."
Else
Wscript.Echo "DHCP could not be enabled."
End If
Next
**************