Once you’ve installed a DHCP server on a computer running Windows Server, you need to authorize that server in Active Directory. If you don’t do this, then the DHCP server won’t be able to lease addresses to clients. You’ll need to run the command with an account that has Enterprise Admin privileges in the forest, or is a Domain Admin account in the forest root domain.
You can do this by running the PowerShell command (where you substitute in the appropriate FQDN and IP address of the DHCP server that you want to authorize). Note that you don’t need to run this on the DHCP server, you can have someone else with the appropriate privileges run it on a DC.
You can view a list of DHCP server that are authorized in AD by running the following command:
Now that the DHCP server is authorized, you’ll need to add a scope. You can do this with the Add-DhcpServerV4Scope cmdlet. For example, to create a scope named Subnet-Alpha that includes the range 172.16.0.100 through 172.16.0.200 with a /24 subnet mask, run the command:
You can check which scopes are present on a server using the Get-DHCPServerV4Scope cmdlet.
You’ll need to add both a default gateway and a DNS server address to that scope, which you can do with the Set-DhcpServerv4OptionValue cmdlet. For example, to set the DNS server to 172.16.0.10 and the default gateway to 172.16.0.1 for the Subnet-Alpha scope, which has the scope ID 172.16.0.100 (or the first address in the range for the scope) run the command:
You can then check that the options have been set correctly using the Get-DhcpServerV4OptionValue cmdlet with the ScopeID parameter.
You can view DHCP leases from a specific scope using the Get-DhcpServerv4Lease cmdlet with the ScopeID parameter.
You can use the Add-DhcpServerv4Reservation cmdlet to convert a lease to a reservation. To do this, you need the MAC address, which is represented by the client ID in the output of Get-DHCPServerV4Lease cmdlet. For example, to create a reservation for the computer with the MAC address 00-16-5d-56-9e-04 for the IP address 172.16.0.45 in the scope ID 172.16.0.0, run the command:
You can validate which reservations are present within a scope using the Get-DhcpServerV4Reservation cmdlet.
If you wish to locate several free IP addresses within a scope that are not being leased, you can use the Get-DhcpServerv4FreeIPAddress cmdlet with the NumAddress parameters. For example, to locate five IP addresses that aren’t being used in the 172.16.0.0 scope, run the command: