PDA

View Full Version : Set objNICs Help Needed



jackdaniels
03-31-2008, 02:44 AM
i can set TCP/IP Preferred DNS and Alternate DNS with that code below;
http://img356.imageshack.us/img356/5745/90075639gv7.jpg


Set objNICs = GetObject("winmgmts://.").InstancesOf("Win32_NetworkAdapterConfiguration")
For Each objNIC In objNICs
If objNIC.IPEnabled Then
objNIC.SetDNSServerSearchOrder Array("4.2.2.1","4.2.2.2")
End If
Next

i need help to restore the default (" . . . "," . . . ")
http://img380.imageshack.us/img380/1669/12289423ge7.jpg

i used this 3 code below but i couldnt manage it;


Set objNICs = GetObject("winmgmts://.").InstancesOf("Win32_NetworkAdapterConfiguration")
For Each objNIC In objNICs
If objNIC.IPEnabled Then
objNIC.IPDisable
End If
Next


Set objNICs = GetObject("winmgmts://.").InstancesOf("Win32_NetworkAdapterConfiguration")
For Each objNIC In objNICs
If objNIC.IPEnabled Then
objNIC.SetDNSServerSearchOrder Array(" . . . "," . . . ")
End If
Next


Set objNICs = GetObject("winmgmts://.").InstancesOf("Win32_NetworkAdapterConfiguration")
For Each objNIC In objNICs
If objNIC.IPEnabled Then
objNIC.SetDNSServerSearchOrder Array("0.0.0.0","0.0.0.0")
End If
Next

GoOgLe
03-31-2008, 02:55 AM
i liked that... i can use it aswell :yes