-
Notifications
You must be signed in to change notification settings - Fork 34
xDhcpServerScope
dscbot edited this page Jan 20, 2025
·
5 revisions
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
|
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.
LeaseDuration: This should be specified in the following format: Days.Hours:Minutes:Seconds
- For example, '
02.00:00:00
' is 2 days and '08:00:00
' is 8 hours.
- Target machine must be running Windows Server 2012 R2 or later.
- Target machine must be running at minimum Windows PowerShell 5.0.
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 'DhcpServerDsc'
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'
}
}