Script which will scan all DHCP scopes and report in which is MAC address located (if any).
1 2 3 4 5 6 7 8 9 10 11 |
# 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”.