Renew all (VBScript)
This code can be found in
Chapter 10 of Windows Server Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' This code renews all DHCP IP addresses.
' ---------------------------------------------------------------
' From the book "Windows Server Cookbook" by Robbie Allen
' ISBN: 0-596-00633-0
' ---------------------------------------------------------------
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set objAdapterConfig = objWMI.Get("Win32_NetworkAdapterConfiguration")
intRC = objAdapterConfig.RenewDHCPLeaseAll()
if intRC = 0 then
WScript.Echo "Renewed all DHCP IP addresses"
elseif intRC = 1 then
WScript.Echo "You must reboot to renew all DHCP IP addresses"
else
WScript.Echo "There was an error renewing all DHCP IP addresses: " & intRC
end if
|
This code has been viewed 1337 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|