Powershell – Search in all DHCP scopes where is located MAC Address

Script which will scan all DHCP scopes and report in which is MAC address located (if any).

# MAC Address to search:
$MacAddress = "E4-A4-71-4E-21-77"

Import-Module DhcpServer -ErrorAction Stop

Get-DhcpServerv4Scope | ForEach-Object {

    # To make static lease uncomment "#" in "#| Add-DhcpServerv4Reservation"
    Get-DhcpServerv4Lease -ScopeId $_.ScopeId | Where-Object { $_.ClientId -eq $MacAddress } #| Add-DhcpServerv4Reservation


If you wish to make static lease for MAC address, uncomment the “| Add-DhcpServerv4Reservation”.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.