Get DHCP Scopes using PowerShell

We need DHCP PowerShell cmdlet to be available in order to manage DHCP. By default, the DHCP module is not loaded in PowerShell. We need to install and the import the DHCP module before we can use it.

Importing DHCP Powershell cmdlet

If you’re going to use PowerShell on the DHCP server, then ensure the Management tools are also installed. Below is the PowerShell command to install DHCP role with management tools

Add-WindowsFeature -Name DHCP –IncludeManagementTools

If you’re going to manage the server remotely, then you can install RSAT tool – features

Add-WindowsFeature RSAT-DHCP

Once installed, import the DHCP module before you can use.

Import-Module DhcpServer

List all the authorized DHCP servers in Active Directory

Get-DhcpServerInDC

Get DHCP scope configuration for one scope

Get-DhcpServerv4Scope –ComputerName <DHCPServerName> –ScopeID <ScopeID>

Get list of all DHCP scopes on a DHCP server

Get-DhcpServerv4Scope –ComputerName <DHCPServerName>

If you need to include more settings like Delay, Description, Name

Get-DhcpServerv4Scope –ComputerName <DHCPServerName> | FL *

 

Get DHCP Server Option

Get-DhcpServerv4OptionValue -ComputerName <ServerName>

 

Get DHCP Scope option

Returns all scope options for a specified DHCP scope:

Get-DhcpServerv4OptionValue -ComputerName <ServerName> –ScopeID <ScopeID>

 

Example: Get-DhcpServerv4OptionValue -ComputerName MyDHCPSvr01 -Scope 10.10.10.0

Check one particular scope option for a subnet:

Get-DHCPServerv4OptionValue -ComputerName <ServerName> -ScopeID <ScopeID> -OptionID <Option>

 

Example: Get-DhcpServerv4OptionValue –ComputerName MyDHCPSvr01 –ScopeID 10.10.10.0 –OptionID 66

 

1 Comment

  1. Howdy I am so excited I found your weblog, I really found you by accident, while I was looking on Bing for something else, Regardless I am here now and would just like to say kudos for a incredible post and a all round thrilling blog (I also love the theme/design), I don’t have time to read it all at the moment but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read more, Please do keep up the great work.

Leave a Reply

Your email address will not be published.