Because Dhcpmgmt.msc is not available in RSAT for Windows 10, PowerShell is a good option to remotely administer your DHCP server. This post is a collection of the most common PowerShell commands for configuring DHCP in your network.
Profile gravatar of Tim Buntrock

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.
Profile gravatar of Tim Buntrock

Add the DHCP server object in the Active Directory domain for the specified server and authorize the server service to serve DHCP clients on the network.

Add the security groups DHCP Users and DHCP Administrators to the DHCP server. (DHCP Users have view-only access to the DHCP server, and DHCP Administrators can administer the DHCP server.)

Set credentials that the DHCP Server service uses to register or deregister client records on a DNS server.

After you issue this command, the cmdlet prompts you to enter the credentials.

Set DHCP server credentials with Set-DhcpServerDnsCredentials

Set DHCP server credentials with Set-DhcpServerDnsCredentials

Add a scope for the IP address range 10.1.1.1 through 10.1.1.254.

Set the DHCP server options for DNS server, DNS domain, and router.

To list the configured options, you can use the following command:

Set the scope options on the specified scope for DNS server, DNS domain, and router.

To list the configured scope options, use this command:

See which scopes are hosted on your DHCP server.

To see all IPv4 scopes, use this command:

To see all IPv6 scopes, use this command:

Exclude the IP address range from 10.1.1.1 through 10.1.1.5 from the scope 10.1.1.0 on the DHCP server named DHCPServer.

Create a reservation for a client.

First, you can get all leases with the following command:

The output will look like this:

DHCP server leases

DHCP server leases

If you want to create a reservation for the client with the IP address 10.1.1.8, type this:

You can also do a bulk import by using a csv file. The csv file should contain the reservations in the following format:

Save the file to c:\dhcp\ClientReservations.csv and run the following command to import the reservations:

Disable and enable the created scope.

To disable the created scope, use this command:

To enable the scope, only change the value from InActive to Active:

Remove the created scope from the DHCP server.

Get DHCP statistics.

You can get statistics from your DHCP server for several values, such as start time, requests, scopes, and much more. To display the statistics, use this command:

The following screenshot will show you the values you can get with the command.

DHCP server statistics

DHCP server statistics

You can display the same for a scope by using Get-DhcpServerv4ScopeStatistics.

Create an active multicast scope.

This command creates a multicast scope with the defined values:

Create and remove a Superscope.

To create a Superscope, use this command:

To remove a Superscope, use this command:

Add a DHCP option definition to your server.

To add the option definition for WPAD, use this command:

Export and import your DHCP server configuration.

To export the configuration of the DHCP server to the specified XML file, use this command:

To import the exported data to another server named DHCPServer2, use this command:

Win the monthly 4sysops member prize for IT pros

Share
0

Related Posts

1 Comment
  1. avatar
    Roy 2 years ago

    So, I have these WAPs that are being assigned IPs via DHCP. I'd like to have them grouped all in the same range instead haphazardly throughout my whole scope. is this possible? seems like it would involve some piping and sorting of commands...

    0

Leave a reply

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

*

CONTACT US

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

Sending
© 4sysops 2006 - 2017

Log in with your credentials

or    

Forgot your details?

Create Account