Skip to content

ipconfig_release_renew.ps1

Corey Watson edited this page Dec 1, 2025 · 1 revision

ipconfig_release_renew.ps1

Release and renew IP configuration on DHCP adapters.

Overview

Releases and renews IP addresses on all DHCP-enabled network adapters, and flushes the DNS cache. Useful for resolving network connectivity issues caused by stale DHCP leases or DNS cache problems.

Purpose

Provides automated network troubleshooting for common connectivity issues related to DHCP and DNS on managed Windows endpoints.

Prerequisites

  • Windows OS with network adapters
  • DHCP-enabled network adapters (static IP adapters are skipped)
  • Admin privileges recommended for DNS flush

Configuration

Required Inputs

  • FlushDns: Whether to flush DNS cache after renewal (default: $true)

Settings

  • Targets only DHCP-enabled adapters
  • Releases IP before renewing
  • Optionally flushes DNS cache

Behavior

  1. Queries all network adapters for DHCP-enabled interfaces
  2. For each DHCP adapter: releases IP, then renews IP
  3. Flushes DNS cache if enabled
  4. Reports results for each adapter

Security Notes

  • No secrets in logs
  • Temporarily disconnects network during release/renew

Exit Codes

  • 0: Success
  • 1: Failure

Example Output

[ INPUT VALIDATION ]
--------------------------------------------------------------
Flush DNS : True

[ OPERATION ]
--------------------------------------------------------------
Found 2 DHCP-enabled adapter(s)
Processing adapter: Ethernet
  Releasing IP address...
  Renewing IP address...
Processing adapter: Wi-Fi
  Releasing IP address...
  Renewing IP address...
Flushing DNS cache...

[ RESULT ]
--------------------------------------------------------------
Status           : Success
Adapters Updated : 2

[ SCRIPT COMPLETED ]
--------------------------------------------------------------

Version History

  • v1.0.0 (2025-11-29): Initial Style A implementation

Links

Clone this wiki locally