Get certain DHCP scope options

by millerlw at 2012-09-11 08:44:43

Our DHCP server has hundreds of scopes in it for remote sites, and each scope has “241 Option 43” set to provide the IP addresses of our wireless controllers to the APs at the remote sites. Recently we changed our controllers to newer versions and I want to find all DHCP scopes that have the old controllers IP addresses in them.

Is there a way, using Powershell, to walk through all of the DHCP scopes and check the “241 Option 43” to see if any are set to the old IP addresses? I suppose that if one IP is searched, it would not have to search for both because if one is there, the other one will be there as well.

I know Powershell can interace with the DHCP server, but I’m not sure how to get it to check the scope option “241 Option 43”.

Thanks in advance,
by DonJ at 2012-09-11 09:24:16
You’re using Microsoft DHCP? Server 2012 (and the Windows 8 RSAT) has a DHCP management module, with commands for pretty much everything. I imagine it can “talk” to older versions of the DHCP service, although I’ve not tested.

Aside from that, I’m not aware of any automation available for the DHCP service except the good old command-line tool.
by millerlw at 2012-09-11 09:36:18
Yes, sorry, I should have been more specific. It is a Windows server, I am a networking guy, not a server guy and only have access to the DHCP scopes on the server, so I didn’t know about the command line tools, hopefully they will serve my purpose.

by DonJ at 2012-09-11 09:44:55
Yeah, so Get-DHCPv4OptionDefinition (and Get-DHCPv4OptionValue) is probably what you want, along with Get-DHCPv4Scope. Again, that’s from the DHCPServer module in the Windows 8 RSAT… which isn’t actually out in final form, yet. Microsoft JUST hooked this stuff up to PowerShell for Win2012; prior to that, it’s pretty dicey in terms of automation.
by RichardSiddaway at 2012-09-13 12:44:03
There was a DHCP module produced that wrapped netsh commands. I tested it a while back and it seemed OK in my test environment
See the links from … ement.aspx

makes sure to test it in your environment.

I would recommend the RSAT tools for windows 8 when they become available - my testing on beta versions showed they worked with older versions of Windows