Manage DHCP Server Module Using PowerShell In Windows Server 2016

It’s easy to manage DHCP Server modules using PowerShell in Windows Server 2016. PowerShell is very powerful and it really makes an Admin’s life easier.. In order to understand this concept, all you have to do is just try to put a little effort into learning the below mentioned Cmdlets,and you’ll be all set.

Once you learn and practice these Cmdlets, you can easily configure/manage or maintain your DHCP Servers in Windows Server 2016. I will try to cover almost each and every helpful Cmdlet that system admins frequently use in their organizations. Okay, so before we start discussing all these various Cmdlets to manage DHCP, let me first explain you what a Cmdlet is?

Cmdlet

A Cmdlet (Command-let) is a light weight command that is used in the PowerShell environment.

Below are the various groups of Cmdlets you should learn/practice a lot for better managing of DHCP Servers using PowerShell.

  1. Add-Dhcpserver Cmdlets———————— ( PART I )
  2. Remove-Dhcpserver Cmdlets—————— ( PART II )
  3. Get-Dhcpserver Cmdlets ———————— ( PART III )
  4. Set-Dhcpserver Cmdlets————————- ( PART IV )

Let’s take a look at Add-Dhcpserver Cmdlets.

Add-Dhcpserver cmdlet allows us to add different services, scopes and configure network addresses and security groups on the DCHP Server. The below table displays most of the Add-DhcpServer cmdlets and their description along with their syntax.

Cmdlet (We use it to…)Syntax
Add-DhcpServerInDC(To add the computer that runs the DHCP server service to the list of authorized DHCP server services in Active Directory.)PS C:\> Add-DhcpServerInDC [[-DnsName] <String>] [[-IPAddress] <IPAddress>]
Add-DhcpServerSecurityGroup(To add security groups to a DHCP server)PS C:\> Add-DhcpServerSecurityGroup [-ComputerName <String>]
Add-DhcpServerv4Scope(To add an IPv4 scope on the DHCP server service)PS C:\> Add-DhcpServerv4Scope [-ComputerName <String>] [-StartRange] <IPAddress> [-EndRange] <IPAddress> [-Name] <String>
Add-DhcpServerv6Scope(To add an IPv6 scope on the DHCP server service)PS C:\> Add-DhcpServerv6Scope [-ValidLifeTime <TimeSpan>] [-ComputerName <String>] [-Prefix] <IPAddress> [-Name] <String>
Add-DhcpServerv4Class(To add an IPv4 vendor or user class to the DHCP server service)PS C:\> Add-DhcpServerv4Class [-ComputerName <String>] [-Type <String>] [-Data <String>]
Add-DhcpServerv6Class(To add an IPv6 vendor or user class to the DHCP server service)PS C:\> Add-DhcpServerv6Class [-ComputerName <String>] [-Type <String>] [-Data <String>]
Add-DhcpServerv4Lease(To add a new IPv4 address lease in the DHCP server service)PS C:\> Add-DhcpServerv4Lease [-IPAddress <IPAddress>] [-ScopeId <Scope ID>] [-ClientId <Client ID>] [-LeaseExpiryTime <DateTime>] [-HostName <String>]
Add-Dhcpseerverv6Lease(To add a new IPv6 address lease in the DHCP server service)PS C:\> Add-DhcpServerv6Lease [-ComputerName <String>] [-IPAddress] <IPAddress> [-ClientDuid] <String> [-Iaid] <UInt32> [-HostName <String>] [-Description <String>] [-LeaseExpiryTime <DateTime>] [-HostName <String>]
Add-DhcpServerv4MulticastExclusionRange(To add a range of addresses to exclude from a multicast scope)PS C:\> Add-DhcpServerv4MulticastExclusionRange [-ComputerName <String>] [-Name] <String> [-StartRange] <IPAddress>[-EndRange] <IPAddress>
Add-DhcpServerv6ExclusionRange(To set the range of IPv6 addresses to exclude from an IPv6 scope)PS C:\> Add-DhcpServerv6ExclusionRange [-ComputerName <String>] [-StartRange] <IPAddress> [-EndRange] <IPAddress>
Add-DhcpServerv4OptionDefinition(To add a DHCPv4 option definition to a DHCP server service)PS C:\> Add-DhcpServerv4OptionDefinition [-ComputerName <String>] [-Name] <String> [-Description <String>] [-OptionId] <UInt32> [-Type] <String> [-MultiValued] [-VendorClass <String>] [-DefaultValue <String[]>]
Add-DhcpServerv6OptionDefinition(To add a DHCPv6 option definition to a DHCP server service)PS C:\> Add-DhcpServerv6OptionDefinition [-ComputerName <String>] [-OptionId] <UInt32> [-Type] <String> [-Name] <String> [-MultiValued] [-Description <String>] [-VendorClass <String>] [-DefaultValue <String[]>]
Add-DhcpServerv4Reservation(To Reserve an IPv4 address in the scope for a client)PS C:\> Add-DhcpServerv4Reservation [-ComputerName <String>] [-ScopeId] <IPAddress> [-IPAddress] <IPAddress> [-ClientId] <String> [-Name <String>] [-Description <String>]
Add-DhcpServerv6Reservation(To Reserve an IPv6 address in the scope for a client)PS C:\> Add-DhcpServerv6Reservation [-ComputerName <String>] [-IPAddress] <IPAddress> [-ClientDuid] <String> [-Iaid] <UInt32>
Add-DhcpServerv4PolicyIPRange(To add an IP range to an existing policy at the scope level)PS C:\> Add-DhcpServerv4PolicyIPRange [-ComputerName <String>] [-Name] <String> [-ScopeId] <IPAddress> [-StartRange] <IPAddress> [-EndRange] <IPAddress>
Add-DhcpServerv4MulticastScope(To add a multicast scope on the DHCP server)PS C:\> Add-DhcpServerv4MulticastScope [-ComputerName <String>] [-Name] <String> [-StartRange] <IPAddress> [-EndRange] <IPAddress> [-Description <String>] [-State <String>] [-LeaseDuration <TimeSpan>]
Add-DhcpServerv4Failover(To add an IPv4 failover relationship on the DHCP server service)PS C:\> Add-DhcpServerv4Failover [-ComputerName <String>] [-Name] <String> [-PartnerServer] <String> [-ScopeId] <IPAddress[]> [-MaxClientLeadTime <TimeSpan>] [-AutoStateTransition <Boolean>][-StateSwitchInterval <TimeSpan>] [-Force] [-SharedSecret <String>]

I will explain the remaining Cmdlets in my upcoming blogs..!