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.

The Author — Mitch Tulloch

Mitch Tulloch is a widely recognized expert on Windows administration, networking, and security. He has been repeatedly awarded Most Valuable Professional (MVP) status by Microsoft for his outstanding contributions in supporting users who deploy and use Microsoft platforms, products and solutions. Mitch has published over two hundred articles on different IT websites and magazines, and he has written or contributed to almost two dozen books and is lead author for the Windows 7 Resource Kit from Microsoft Press. For more information, see .

Latest Contributions

Featured Links