$ConfigData = @{ 
    AllNodes  = @( 
        @{ 
            NodeName       = "SRVDC03" 
            Role           = "DomainController" 
            WindowsFeature = 'AD-Domain-Services' 
        } 
        @{ 
            NodeName       = "SRVDC04" 
            Role           = "DomainController" 
            WindowsFeature = 'AD-Domain-Services'  
  
        } 
        @{ 
            NodeName       = 'SRVDHCP' 
            Role           = 'DHCP' 
            WindowsFeature = 'DHCP' 
            DHCPScope      = @{ 
                IPEnd      = '10.0.0.1' 
                IPStart    = '10.10.0.50' 
                ScopeName  = 'LabScope' 
                SubnetMask = '255.255.255.0' 
            } 
        } 
    ) 
    OtherData = "Version 1.0" 
} 

configuration MyConfigData 
{ 
    Import-DscResource -module xDHCpServer, 
    PSDesiredStateConfiguration 
    node $AllNodes.NodeName 
    { 
        WindowsFeature InstallRole 
        { 
            Ensure = 'Present' 
            Name   = $Node.WindowsFeature 
        } 
        Registry VersionConfig 
        { 
            Ensure    = "Present" 
            Key       = "HKEY_LOCAL_MACHINE\SOFTWARE\DSC\" 
            ValueName = "VersionConfig" 
            ValueType = "String" 
            ValueData = $ConfigurationData.OtherData 
        } 
  
    } 
    node $AllNodes.Where{ $_.Role -eq 'DHCP' }.NodeName 
    { 
        xDhcpServerScope LabScope 
        { 
            Ensure       = 'Present' 
            IPEndRange   = $Node.DHCPScope.IPEnd 
            IPStartRange = $Node.DHCPScope.IPStart 
            Name         = $Node.DHCPScope.IPEnd.ScopeName 
            SubnetMask   = $Node.DHCPScope.SubnetMask 
            DependsOn    = "[WindowsFeature]InstallRole" 
        } 
    } 
}

MyConfigData -ConfigurationData $ConfigData `
    -OutputPath C:\Script\MyConfigData  
Start-DscConfiguration -Path C:\Script\MyConfigData -Wait `
    -Verbose
