How to Create a DHCP IPv4 Scope with PowerShell
Applies to: Windows Server 2019, 2022 and 2025.
A DHCP scope defines the lease pool for one subnet. Exclusions, gateway, DNS and lease duration must reflect the actual network design.
DNS and DHCP changes can interrupt authentication and remote access. Preserve console access, export current settings and test from representative clients. Managed Windows VPS services are available at networkmanager.info.
Prerequisites
- Reserve infrastructure addresses outside the pool.
- Confirm subnet mask, gateway and DNS servers.
- Select lease duration from client mobility.
- Verify no overlapping scope exists.
Procedure
Step 1: List scopes
Check existing ranges.
Get-DhcpServerv4ScopeStep 2: Create the scope
Use approved production values instead of TEST-NET examples.
Add-DhcpServerv4Scope -Name 'Office LAN' -StartRange 192.0.2.100 -EndRange 192.0.2.200 -SubnetMask 255.255.255.0 -State Active -LeaseDuration 8.00:00:00Step 3: Add exclusions
Protect fixed infrastructure range.
Add-DhcpServerv4ExclusionRange -ScopeId 192.0.2.0 -StartRange 192.0.2.100 -EndRange 192.0.2.119Step 4: Set options
Configure gateway, domain and DNS.
Set-DhcpServerv4OptionValue -ScopeId 192.0.2.0 -Router 192.0.2.1 -DnsDomain 'corp.example' -DnsServer 192.0.2.20,192.0.2.21Step 5: Test a client
Renew an approved test device and inspect the lease.
Verification
Review scope state, options, exclusions and issued leases.
Get-DhcpServerv4Scope -ScopeId 192.0.2.0
Get-DhcpServerv4OptionValue -ScopeId 192.0.2.0
Get-DhcpServerv4Lease -ScopeId 192.0.2.0Rollback
Deactivate the new scope before removal. Restore previous options and never delete active leases without an outage plan.
Operational notes
Replace every example address. TEST-NET ranges are documentation-only and must not be copied into production.