The Code
Type the script into Notepad (with Word Wrap disabled) and save
it with a .vbs extension as
ReleaseRenew.vbs:
On Error Resume Next
Dim AdapterConfig
Dim RetVal
Set AdapterConfig = GetObject("winmgmts:Win32_NetworkAdapterConfiguration")
'WMI release IP Address for all installed network adapters
RetVal = AdapterConfig.ReleaseDHCPLeaseAll
'if retval = 1 then display success. If 0 then failure
If RetVal = 1 Then
MsgBox "IP Address Release was successful."
Else
MsgBox "DHCP Release failed!"
End If
'WMI renew ip for all network adapters
RetVal = AdapterConfig.RenewDHCPLeaseAll
'if retval = 1 then display success. If 0 then failure
If RetVal = 1 Then
MsgBox "IP Address Renew was successful."
Else
MsgBox "DHCP Renew failed!"
End If
Set AdapterConfig = Nothing
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/releasedhcpleaseall_method_in_class_win32_networkadapterconfiguration.asp