xDhcpServerOption fails

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Alex Soury Alex Soury 1 year, 11 months ago.

  • Author
    Posts
  • #25760
    Profile photo of Alex Soury
    Alex Soury
    Participant

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

  • #25762
    Profile photo of Daniel Krebs
    Daniel Krebs
    Moderator

    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'
    }
    
  • #25792
    Profile photo of Alex Soury
    Alex Soury
    Participant

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

You must be logged in to reply to this topic.