Release All DHCP Leases

Releases all the DHCP leases currently in use on a computer.

VBScript Code


On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set objNetworkSettings = objWMIService.Get("Win32_NetworkAdapterConfiguration")
objNetworkSettings.ReleaseDHCPLeaseAll()