Private/Get-DSCLabConfiguration.ps1

function Get-DSCLabConfiguration {
        [CmdletBinding()]
        Param()
    @'
configuration Sample_xDscWebService
{
    param
    (
            [string[]]$NodeName = 'localhost',
 
            [Parameter(HelpMessage='Use AllowUnencryptedTraffic for setting up a non SSL based endpoint (Recommended only for test purpose)')]
            [ValidateNotNullOrEmpty()]
            [string] $certificateThumbPrint,
 
            [Parameter(HelpMessage='This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')]
            [ValidateNotNullOrEmpty()]
            [string] $RegistrationKey = "3cf98503-779a-4b9d-8853-2e49fe5a2c99" #([guid]::NewGuid()).Guid
    )
    Import-DSCResource -ModuleName 'PSDesiredStateConfiguration'
    Import-DSCResource -ModuleName 'xDHCPServer' -ModuleVersion 1.6.0.0
    Import-DSCResource -ModuleName 'xDNSServer' -ModuleVersion 1.10.0.0
    Import-DSCResource -ModuleName 'cDhcpServerDynamicUpdate' -ModuleVersion 1.3
    Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration' -ModuleVersion 3.13.0.0
    Import-DSCResource -ModuleName 'xNetworking'
 
    Node $NodeName
    {
        WindowsFeature DSCServiceFeature
        {
            Ensure = "Present"
            Name = "DSC-Service"
        }
 
        xDscWebService PSDSCPullServer
        {
            Ensure = "Present"
            EndpointName = "PSDSCPullServer"
            Port = 8086
            PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer"
            CertificateThumbPrint = $certificateThumbPrint
            ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules"
            ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration"
            State = "Started"
            DependsOn = "[WindowsFeature]DSCServiceFeature"
        }
 
        File RegistrationKeyFile
        {
            Ensure = 'Present'
            Type = 'File'
            DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
            Contents = $RegistrationKey
        }
 
        WindowsFeature DHCPServerFeature
        {
            Ensure = "Present"
            Name = "DHCP"
        }
 
        WindowsFeature DHCPRSAT
        {
            Ensure = "Present"
            Name = "RSAT-DHCP"
        }
 
        xDhcpServerScope DHCPScope
        {
            IPEndRange = '10.0.0.254'
            IPStartRange = '10.0.0.200'
            Name = 'NodeScope'
            SubnetMask = '255.255.255.0'
            DependsOn = '[WindowsFeature]DHCPServerFeature'
        }
 
        xDhcpServerOption Option
        {
            Ensure = 'Present'
            ScopeID = '10.0.0.0'
            DnsDomain = 'DSCPullServerLab.com'
            DnsServerIPAddress = '10.0.0.10'
            Router = '10.0.0.254'
        }
         
        WindowsFeature DNSServerFeature
        {
            Ensure = 'Present'
            Name = 'DNS'
        }
 
        WindowsFeature DNSRSAT
        {
            Ensure = 'Present'
            Name = 'RSAT-DNS-Server'
        }
 
        xDnsServerPrimaryZone DNSZone
        {
            Ensure = 'Present'
            Name = 'DSCPullServerLab.com'
            DynamicUpdate = 'NonsecureAndSecure'
            DependsOn = '[WindowsFeature]DNSServerFeature'
        }
 
        xDnsRecord DSCPullServerARecord
        {
            Ensure = 'Present'
            Name = 'DSCPullServer'
            Target = '10.0.0.10'
            Zone = "DSCPullServerLab.com"
            Type = "ARecord"
            DependsOn = '[xDnsServerPrimaryZone]DNSZone'
        }
 
        cDhcpServerDynamicUpdate dynUpdate {
            dhcpServerDynamicUpdateSetting = 'Always'
            DependsOn = '[WindowsFeature]DHCPServerFeature'
        }
 
        xDnsConnectionSuffix dnsConnectionSuffix {
            Ensure = 'Present'
            ConnectionSpecificSuffix = 'DSCPullServerLab.com'
            InterfaceAlias = 'Ethernet'
        }
    }
}
'@

}