Using PowerShell to create a DHCP server scope

by Mitch Tulloch [Published on 21 Aug. 2013 / Last Updated on 21 Aug. 2013]

A tip on how you can use Windows PowerShell to create a DHCP server scope.

You can manage Windows Server 2012 DHCP servers using Windows PowerShell. Common DHCP server-management tasks include creating scopes, creating exclusion ranges, creating reservations, configuring scope and server options, and so on.

For example, let’s begin by viewing all the scopes currently configured on the DHCP server:

PS C:\> Get-DhcpServerv4Scope
ScopeId      SubnetMask      Name  State   StartRange   EndRange      LeaseDuration
-------            ------------------     ---------  -----   ----------------   ---------------      -------------   test   Active  8.00:00:00

Note that there is currently only one active scope on the DHCP server. Now add a second scope for the IP address range through Leave the scope inactive until you finish configuring exclusions and reservations for it:

PS C:\> Add-DhcpServerv4Scope -EndRange -Name test2 `
-StartRange -SubnetMask -State InActive

Note that in this cmdlet it doesn’t matter what order you specify the parameters in because you specified the end of the address range before specifying its beginning.

Running Get-DdhpServerv4Scope again indicates that adding the new scope was successful:

PS C:\> Get-DhcpServerv4Scope
ScopeId      SubnetMask      Name   State    StartRange    EndRange      LeaseDuration
-----------      -----------------      ---------   -------    ---------------    ---------------      -------------   test   Active  8.00:00:00   test2  Inactive 8.00:00:00

Mitch Tulloch is a nine-time recipient of the Microsoft Most Valuable Professional (MVP) award and
a widely recognized expert on Windows administration, deployment and virtualization.  For more information see This tip was excerpted from his latest book Training Guide: Installing and Configuring Windows Server 2012 from Microsoft Press.

See Also

The Author — Mitch Tulloch

Mitch Tulloch is a well-known expert on Windows Server administration and cloud computing technologies. He has published over a thousand articles on information technology topics and has written, contributed to or been series editor for over 50 books.

Featured Links