Skip to main content

PowerShell DHCP command generator (Windows Server)

Parametric generator for the Windows DhcpServer PowerShell module. Fill in the DHCP server hostname, scope, MAC, and other values once — every command on the page substitutes them in real time. Covers queries, reservations, bulk imports (CSV + inline), scope management, common DHCP options (66 / 67 / 150 / 43), and server diagnostics.

⚠ Disclaimer These commands are provided as-is, for educational and planning purposes only. Run only against DHCP servers you are authorised to operate. Always export a full server backup first (Export-DhcpServer ... -Leases -Force) and test destructive operations in a maintenance window. Bulk reservation changes can take a scope offline; DHCP option mistakes can break phones / PXE / VoIP for an entire site. The Tech Space makes no warranty and accepts no liability. Full disclaimer →
Before you start: these cmdlets come from the DhcpServer module (part of RSAT). On the management workstation run Install-WindowsFeature -Name RSAT-DHCP (server) or Get-WindowsCapability -Online -Name Rsat.Dhcp*Add-WindowsCapability -Online -Name <name> (client). You'll also need a domain account with DHCP Administrators rights (or local Administrator on the DHCP server). Use -WhatIf on any destructive cmdlet to preview the change before committing.

Variables · fill in your values

MAC accepts any common format (colons / hyphens / dots / no separator) and is auto-normalised to 00-11-22-33-44-55 for PowerShell. Values persist in your browser between visits.

Reference

Lease duration format

  • 1.00:00:00 1 day
  • 8.00:00:00 8 days (Windows default)
  • 00:08:00 8 minutes (PXE / lab use)
  • 04:00:00 4 hours
  • Format: [d.]hh:mm:ss

Common DHCP options

  • 3 Router (default gateway)
  • 6 DNS servers (IP array)
  • 15 DNS domain name
  • 42 NTP servers (IP array)
  • 43 Vendor-specific info (binary / hex)
  • 60 Vendor class identifier
  • 66 TFTP server name (string)
  • 67 Boot file name (string)
  • 119DNS domain search list
  • 120SIP server address (IP phones)
  • 150Cisco IP phone TFTP (IP array)

Reservation Type values

  • Both DHCP + BOOTP (default)
  • Dhcp DHCP only
  • Bootp BOOTP only
  • None Disabled (reservation kept but inactive)

Scope State values

  • Active Scope serving leases
  • InActive Scope present but not serving

Note the capitalisation: PowerShell expects InActive (one word, capital I and A) — not Inactive.

Address State values (leases)

  • Active Currently leased
  • Declined Client declined the lease
  • Expired Lease window passed
  • InactiveReservation Reservation, not currently in use
  • ActiveReservation Reservation, in use

Useful safety patterns

  • -WhatIf Preview a destructive cmdlet
  • -Confirm:$false Suppress confirmation in scripts
  • -ErrorAction Stop Convert non-terminating errors to terminating (for try/catch)
  • -Verbose Show progress on bulk operations

Source: Microsoft Learn — DhcpServer PowerShell module.