How to Windows Windows Server

How to Install & Configure DHCP on Server 2016 with PowerShell?

Since Dynamic Host Configuration Protocol (DHCP) Plays a key role to give clients IP, we need to configure that as Perfectly as we can but before installing and Configuring DHCP Server Role we have to learn How it Works?

DHCP is a network Protocol which is used in Internet Protocol. The server that supports the protocol is called DHCP server. As its name indicates, DHCP server dynamically distributes IP for network interfaces and devices. When somebody sends a request for IP, DHCP server distributes IP address based on the DHCP server configurations. DHCP is a role in Windows Server 2016. The things which we are going to discuss:

  • Install DHCP Role with PowerShell.
  • Set a Static IP address.
  • Create Scope with PowerShell

Visit Related Articles about PowerShell:

Install DHCP Role with PowerShell

Step 1.  Open PowerShell.

Step 2. Type Get-Windowsfeature Command to show a list of the Features available in the Server.

Step 3. Since we are installing DHCP, we need to find that. When you find that copy its name.

How Install Configure DHCP Server windows Server 2016?
Get Windows Feature

Step 4. To install it type Install-WindowsFeature -Name DHCP -Restart –IncludeManagementTools command. When the installation Completes it will look like this.

How Install Configure DHCP Server windows Server 2016?
DHCP installed

Note: You can see a Yellow bar on the screenshot. It says that no static IP addresses were found on this computer. So we need to configure a static IP address.

Set a Static IP Address

Step 1. To set a static IP address with PowerShell type Get-NetIPConfiguration cmdlet.

The Get-NetIPConfiguration cmdlet gets network configuration, including usable interfaces, IP addresses, and DNS servers.

How Install Configure DHCP Server windows Server 2016?
Get-NetIpconfiguration

Step 2. Now that you have those Information, type New-NetIPAddress -IPAddress <> InterfaceAlias <> cmdlet. This cmdlet creates and configures an IP address.

Note:

  • Instead of <> after IP address type an IP like 140.150.10.0 which you want to be a static IP.
  • Instead of <> after InterfaceAlias, type the Internet Port which you get from Get-NetIPconfiguration cmdlet.
How Install Configure DHCP Server windows Server 2016?
New IP address

Now that we have installed and configured the static IP Address let’s get into configuring the DHCP for creating Scopes.

Creating Scope with PowerShell

To create a scope, I am using the add-dhcpserverv4scope cmdlet, this cmdlet allows you to Add an IPv4 scope on the Dynamic Host Configuration Protocol (DHCP) server service. Here is the full command to create a new scope.

Add-DhcpServerv4Scope -Name ‘Quetta Lab’ -StartRange 140.150.10.1 -EndRange 140.150.10.100 -S

ubnetMask 255.255.255.0 -Description “This scope has been created for Quetta Users”

How Install Configure DHCP Server windows Server 2016?
Scope Created

Summary

  • Type Get-WindowsFeature cmdlet and copy the DHCP Name.
  • Type this Install-WindowsFeature -Name DHCP -Restart –IncludeManagementTools cmdlet to install DHCP.
  • Type Get-NetIPConfiguration cmdlet to get the network information.
  • Type this command to renew the IP address New-NetIPAddress -IPAddress <> InterfaceAlias <>.
  • and Finally, type Add-DhcpServerv4Scope -Name ‘Quetta Lab’ -StartRange 140.150.10.1 -EndRange 140.150.10.100 -SubnetMask 255.255.255.0 -Description “This scope has been created for Quetta Users” cmdlet to create the scope.

That’s all, I hope this article helped you Install and Configure DHCP with PowerShell on Server 2016. If you liked this article, then please subscribe to our YouTube Channel for WordPress, Windows Server, the Internet and Business video tutorials. You can also find us on Twitter and Facebook.

Related posts

How to fix Startup and POST Errors of a Computer

BISMO

Create Pre-Staged Read-Only Domain Controller (RODC)

BISMO

100 Most Essential Keyboard Shortcuts

BISMO

Leave a Comment