Skip to content

DhcpScopeOptionValue

dscbot edited this page Oct 16, 2025 · 5 revisions

Parameters

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.

Description

The DhcpScopeOptionValue DSC resource manages option values on scope level.

Requirements

  • Target machine must be running Windows Server 2012 R2 or later.
  • Target machine must be running at minimum Windows PowerShell 5.0.

Examples

Example 1

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'
    }
}

Clone this wiki locally