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

 

9 Comments

  1. Wow, awesome blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your site is wonderful, let alone the content!

  2. I was just looking for this info for a while. After six hours of continuous Googleing, at last I got it in your website. I wonder what is the lack of Google strategy that don’t rank this kind of informative websites in top of the list. Generally the top web sites are full of garbage.

Leave a Reply

Your email address will not be published.