Using 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.

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top