Skip to main content

Renew a DHCP Lease

Problem

You want to renew the DHCP lease for a connection on a computer.

Solution

To renew DHCP leases, use the ipconfig application. To renew the lease on all connections:

PS >ipconfig /renew

To renew the lease on a specific connection:

PS >ipconfig /renew "Wireless Network Connection 4"

Discussion

The standard ipconfig application works well to manage network configuration options on a local machine. To renew the lease on a remote computer, you have two options.

Use the Win32_NetworkAdapterConfiguration WMI class

To renew the lease on a remote computer, use the Win32_ NetworkAdapterConfiguration WMI class. The WMI class requires that you know the description of the network adapter, so first obtain that by reviewing the output of GetWmiObject Win32_NetworkAdapterConfiguration –Computer :

PS >GetWmiObject Win32_NetworkAdapterConfiguration –Computer LEEDESK

(...) DHCPEnabled : True IPAddress : {192.168.1.100} DefaultIPGateway : {192.168.1.1} DNSDomain : hsd1.wa.comcast.net. ServiceName : USB_RNDIS Description : Linksys WirelessG USB Network Adapter with (...) Index : 13 (...)

Knowing which adapter you want to renew, call its RenewDHCPLease() method:

$description = "Linksys WirelessG USB"

$adapter = GetWmiObject Win32_NetworkAdapterConfiguration –Computer LEEDESK |

WhereObject { $_.Description –match $description}

$adapter.RenewDHCPLease()

Run ipconfig on the remote computer

PS >InvokeRemoteExpression \\LEEDESK { ipconfig /renew }

For businesses managing Windows-based workloads, a Singapore Dedicated Server provides dedicated infrastructure for network administration, connectivity management, PowerShell automation, and production application environments.

Help Category