Repository navigation
DhcpScopeOptionValue
dscbot edited this page Oct 16, 2025
·
5 revisions
| Parameter | Attribute | DataType | Description | Allowed Values |
|---|---|---|---|---|
| AddressFamily | Key | String | Address family. Currently needs to be IPv4. | IPv4 |
| OptionId | Key | UInt32 | Option ID, specify an integer between 1 and 255. | |
| ScopeId | Key | String | Scope ID to set the option. | |
| UserClass | Key | String | User class. Use an empty string for default user class. | |
| VendorClass | Key | String | Vendor class. Use an empty string for default vendor class. | |
| Ensure | Write | String | Whether the DHCP option should exist. |
Present, Absent
|
| Value | Write | StringArray[] | Option data value. |
The DhcpScopeOptionValue DSC resource manages option values on scope level.
- Target machine must be running Windows Server 2012 R2 or later.
- Target machine must be running at minimum Windows PowerShell 5.0.
This example shows how to substitute the xDhcpServerOption resource, setting the gateway (option 3), DNS Servers (option 6) and domain name (Option 15).
configuration Example
{
Import-DscResource -ModuleName 'PSDscResources' -ModuleVersion '2.12.0.0'
Import-DscResource -moduleName 'DhcpServerDsc'
WindowsFeature 'DHCP'
{
Name = 'DHCP'
Ensure = 'Present'
}
# Setting scope gateway
DhcpScopeOptionValue 'ScopeOptionGateway'
{
OptionId = 3
Value = '1.1.1.1'
ScopeId = '1.1.1.0'
VendorClass = ''
UserClass = ''
AddressFamily = 'IPv4'
}
# Setting scope DNS servers
DhcpScopeOptionValue 'ScopeOptionDNS'
{
OptionId = 6
Value = @('1.1.1.1', '2.2.2.2')
ScopeId = '1.1.1.0'
VendorClass = ''
UserClass = ''
AddressFamily = 'IPv4'
}
# Setting scope DNS domain name
DhcpScopeOptionValue 'ScopeOptionDNSDomainName'
{
OptionId = 15
Value = 'contoso.com'
ScopeId = '1.1.1.0'
VendorClass = ''
UserClass = ''
AddressFamily = 'IPv4'
}
}