skrypt dhcp , problem default gateway

Autor: thim <thimothy_at_gazeta.pl>
Data: Wed 02 Jan 2008 - 12:19:17 MET
Message-ID: <flfrrp$83d$1@inews.gazeta.pl>

Witam
Mam skrypt vbs ktory automatycznie zamienia mi ustawienia karty sieciowej na
dhcp, na xp wszystko dziala oki, ale mam problem z win 2000
Otóż w 2000 skrypt ten prawidłowo ustawia karte sieciowa na dhcp, ale jezeli
dam ipconfig /all to pokazuje on jako defaultgateway stary statyczny wpis,
pomimo ze faktycznie system juz korzysta z gatewaya ustawianego przez dhcp.
Przejżałem rejestr i wisi tam faktycznie w kluczu DefaultGateway stary ipek.
Jak zmodyfikować ten skrypt aby mi usuwał ten wpis z rejestru?

oto skrypt:

On Error Resume Next
Set objWMIService = GetObject("winmgmts:")
'Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
' If the office uses DHCP, call SetDHCP.
SetDHCP

'******************************************************************************
Sub SetDHCP

For Each objNicConfig In colNicConfigs

'WScript.Echo VbCrLf & "Network Adapter " & objNicConfig.Index & _
'VbCrLf & " " & objNicConfig.Description & VbCrLf
If Not objNicConfig.DHCPEnabled Then
intReturn = objNicConfig.EnableDHCP
'If intReturn = 0 Then
'WScript.Echo " DHCP enabled."
'Else
'WScript.Echo " Unable to enable DHCP." & " Error #:" & intReturn
'End If
intDNS = objNicConfig.SetDNSServerSearchOrder(null)
Err.Clear
'Else
'WScript.Echo " DHCP already enabled" & VbCrLf & _
'" DHCP Server: " & objNicConfig.DHCPServer
Err.Clear
End If

Next
End Sub
Received on Wed Jan 2 12:20:12 2008

To archiwum zostało wygenerowane przez hypermail 2.1.8 : Wed 02 Jan 2008 - 12:42:00 MET