Author Posts

May 28, 2015 at 7:12 pm

I'm trying to use DSC to configure DHCP. The configuration errors with this message "PowerShell DSC Resource MSFT_xDhcpServerOption failed to execute Test-TargetResource functionality with error message: DHCP server scopeID 192.168.100.0 is not valid. Supply a valid scope and try again"

Here is a snip of my configuration. Has anyone else had any success with this?

WindowsFeature DhcpInstall
{
Ensure = "Present"
Name = "DHCP"
DependsOn = "[xADDomain]FirstDS"
}
xDhcpServerOption DhcpOption
{
Ensure = 'Present'
ScopeID = '192.168.100.0'
DnsDomain = 'AcesHigh.local'
DnsServerIPAddress = '192.168.100.3'
AddressFamily = 'IPv4'
DependsOn = "[WindowsFeature]DhcpInstall"
}

xDhcpServerScope Scope
{
Ensure = 'Present'
IPEndRange = '192.168.100.200'
IPStartRange = '192.168.100.100'
Name = 'PowerShellScope'
SubnetMask = '255.255.255.0'
LeaseDuration = '00:08:00'
State = 'Active'
AddressFamily = 'IPv4'
DependsOn = "[xDhcpServerOption]DhcpOption"
}

May 28, 2015 at 9:59 pm

You will need to create your scope before setting scope options. Does that make sense?

WindowsFeature DhcpInstall
{
    Ensure = 'Present'
    Name = 'DHCP'
    DependsOn = '[xADDomain]FirstDS'
}

xDhcpServerScope Scope
{
    Ensure = 'Present'
    IPEndRange = '192.168.100.200'
    IPStartRange = '192.168.100.100'
    Name = 'PowerShellScope'
    SubnetMask = '255.255.255.0'
    LeaseDuration = '00:08:00'
    State = 'Active'
    AddressFamily = 'IPv4'
    DependsOn = '[WindowsFeature]DhcpInstall'
}

xDhcpServerOption DhcpOption
{
    Ensure = 'Present'
    ScopeID = '192.168.100.0'
    DnsDomain = 'AcesHigh.local'
    DnsServerIPAddress = '192.168.100.3'
    AddressFamily = 'IPv4'
    DependsOn = '[xDhcpServerScope]Scope'
}

May 29, 2015 at 8:30 am

Ah yes, that did the trick! Not sure how I missed that. Thanks for the help.