...Because someone's gotta tell the story...


To return to the main Blog List, click Full Blog Listing.


Site Updates

Extracting Reservations from a DHCP Scope

Wednesday, August 24, 2016 in Powershell (Views: 1624)
Just a quick blog to discuss how to extract existing reservations into a text file using PowerShell and Server 2012/R2.

The following PowerShell should do the trick...

Get-DHCPServerV4Scope | ForEach {
Get-DHCPServerv4Lease -ScopeID $_.ScopeID | where {$_.AddressState -like '*Reservation'}
} | Select-Object ScopeId,IPAddress,HostName,ClientID,AddressState | Export-Csv ".\$($env:COMPUTERNAME)-Reservations.csv" -NoTypeInformation

Your output will look like this...

Happy scripting.


Related Blogs You May Be Interested In:

To leave a comment, please log in and/or register.