-
Notifications
You must be signed in to change notification settings - Fork 34
DhcpScopeOptionValue
dscbot edited this page Jan 20, 2025
·
4 revisions
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
ScopeId | Key | String | Scope ID to set the option. | |
OptionId | Key | UInt32 | Option ID, specify an integer between 1 and 255. | |
Value | Write | StringArray[] | Option data value. | |
VendorClass | Key | String | Vendor class. Use an empty string for default vendor class. | |
UserClass | Key | String | User class. Use an empty string for default user class. | |
AddressFamily | Key | String | Address family. Currently needs to be IPv4. | IPv4 |
Ensure | Write | String | Whether the DHCP option should exist. |
Present , Absent
|
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'
}
}