Skip to content

xDhcpServerScope

dscbot edited this page Aug 18, 2023 · 2 revisions

xDhcpServerScope

Parameters

Parameter Attribute DataType Description Allowed Values
ScopeId Key String ScopeId for the given scope
Name Required String Name of DHCP Scope
SubnetMask Required String Subnet mask for the scope specified in IP address format
IPStartRange Required String Starting address to set for this scope
IPEndRange Required String Ending address to set for this scope
Description Write String Description of DHCP Scope
LeaseDuration Write String Time interval for which an IP address should be leased
State Write String Whether scope should be active or inactive Active, Inactive
AddressFamily Write String Address family type IPv4
Ensure Write String Whether scope should be set or removed Present, Absent

Description

The xDhcpServerScope DSC resource manages IP address scopes. An IP-address scope is a consecutive range of possible IP addresses that the DHCP server can lease to clients on a subnet.

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 creates a new DHCP Server scope, or if the scope already exist it changes an existing scope.

configuration Example
{
    Import-DscResource -ModuleName 'PSDscResources' -ModuleVersion '2.12.0.0'
    Import-DscResource -moduleName 'xDhcpServer'

    WindowsFeature 'DHCP'
    {
        Name   = 'DHCP'
        Ensure = 'Present'
    }

    xDhcpServerScope 'Scope'
    {
        Ensure        = 'Present'
        ScopeId       = '192.168.1.0'
        IPStartRange  = '192.168.1.1'
        IPEndRange    = '192.168.1.254'
        Name          = 'ContosoScope'
        SubnetMask    = '255.255.255.0'
        LeaseDuration = ((New-TimeSpan -Hours 8).ToString())
        State         = 'Active'
        AddressFamily = 'IPv4'
    }
}