Monthly Archive


PowerShell 3 and DHCP 2: scopes

In this post

I showed how we could discover DHCP server information

Scopes can be discovered

Get-DhcpServerv4Scope -ComputerName server02  -ScopeId

Now how do we create a scope?

We use Add-DhcpServerv4Scope. Now shouldn’t that have been New-DhcpServerv4Scope?

Never the less this is how it works

Add-DhcpServerv4Scope -ComputerName server02 -Name TestScope 
-StartRange -EndRange
-Description "Scope for testing" -Type DHCP
-State Active -SubnetMask
-LeaseDuration (New-TimeSpan -Days 1)

Type can be Dhcp,Bootp or Both

State can be Active or InActive

This creates and activates the scope

To inactivate a scope

Set-DhcpServerv4Scope -ComputerName server02
-State Inactive

To reactivate

Set-DhcpServerv4Scope -ComputerName server02
-State Active

To create a reservation

Add-DhcpServerv4Reservation -ComputerName server02
-ScopeId -IPAddress
-ClientId 00-01-02-03-04-05 -Name Test57 
-Description "Exclusion for test device"

The ClientId is the MAC address (this one is made up)

To view the scopes reservations

Get-DhcpServerv4Reservation -ComputerName server02 -ScopeId

To remove a reservation

Remove-DhcpServerv4Reservation -ComputerName server02
-ScopeId -ClientId 00-01-02-03-04-05

Leave a Reply