Joshua May
Joshua May

Reputation: 33

Powershell - Set DHCP scope option to a predefined value

I am looking for a way to set DHCP Scope options on a scope so that when the predefined default value for the server is changed, it changes on the scope.

When I use the MMC Snap In to turn an option on(and it has a predefined option value), this is how it works, so I know it's possible, i just don't know if it's possible WITH POWERSHELL.

Anyone know if there is a way, directly or indirectly, to achieve this in powershell?

To clarify, If I check a box on the MMC Snap In for Scope Option 042, it will set the value to, lets say "1.2.3.4", automatically. If i go change that value on the server's predefined option list, it also changes on the scope. If I use set-dhcpserverv4optionvalue to set that same option to "1.2.3.4", then change the predefined option, the scope stays at "1.2.3.4".

Upvotes: 1

Views: 2666

Answers (1)

briantist
briantist

Reputation: 47792

Your clarification is a little bit ambiguous, but my interpretation is that you are:

  1. Enabling a scope level option with a pre-defined value (inherited from the server level).
  2. Changing the server level pre-defined value, which then changes the value at the scope level.
  3. Changing the scope level value using Set-DhcpServerv4OptionValue -ScopeId.
  4. Changing the server level pre-defined value, which then does not change the scope level value.

If my interpretation is correct, then this is the expected behavior. You might thing about this like you would Cascading Style Sheets or Group Policy Objects: the most specific setting wins.

Once you set the value at the scope level, it no longer inherits its value from the server level.

If you use Set-DchpServerv4OptionValue without specifying -ScopeId then it will set the server level value.

Edit based on comment:

Now that I better understand, I think that this functionality is missing in the PowerShell cmdlets. You could set the server level default value, and you can set an explicit value on a scope, but I don't see any way of enabling an option on a scope that uses the default value rather than an explicit one.

The DHCP cmdlets are fairly thin wrappers around the underlying CIM/WMI objects, so it might be possible with CIM/WMI calls, but I don't know how to do it offhand.

Upvotes: 1

Related Questions