Because the Remote Server Administration Tools (RSAT) for Windows 10 don't have a dynamic host configuration protocol (DHCP) management tool, PowerShell is a good option to administer your DHCP server remotely. This PowerShell script allows you to create a DCHP IPv4 scope remotely.

Tim Buntrock

Tim Buntrock is one of three enterprise administrators for the Active Directory service of a "global player" in the contact center business. He is a certified engineer for MCTS, MCITP, MCSA and MCPS.

A pop-up window will display when you start the script. It will ask on which DHCP server you want to add the scope. This works on your server remotely or locally. Using $env:computername will add the local computer name to input automatically.

Enter DHCP server name

Enter DHCP server name

The corresponding code looks like this:

The entered name will be saved into the $dhcpserver variable, so we can use it later to create the scope.

The script does the same for the scope name, scope ID, start and end IP, netmask, and the router. I predefined some values such as the netmask to speed up the process.

The script will then display all entered values, so you can review everything:

In addition, you have to type in y to continue.

Scope overview

Scope overview

If you then press the y key, the script will create the DHCP by using the Add-DHCPServer4Scope and Set-DHCPServer4OptionValue cmdlets. To exit the script at this point, you can press any other key.

The script will then show the configured settings of your new DHCP scope:

Scope settings

Scope settings

When you open the DHCP console on your server, you should now see the new scope:

The new scope in the DHCP console

The new scope in the DHCP console

This is the complete script:

The script is also available on TechNet. When I improve the script, I will update it there.
If you don’t want to work with input boxes, you can also define all values directly in the script:

Join the 4sysops PowerShell group!

1 Comment
  1. Wessel 4 years ago

    So basically, you made a GUI for 2 lines of PowerShell?
    I think this post should've been called 'How to make a PowerShell-GUI' (or inputbox really). No offense, it was nice to read.


Leave a reply

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


© 4sysops 2006 - 2019


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account