While the video covers most of this material, here is the accompanying write-up. Let’s run through setting up a DSC Pull Server!

First off, this scenario is covering the setup of a single DSC Pull Server demo-srv, and a single DSC client demo-client. The client is using named DSC configurations, and is pulling a configuration named webservice

While the video covers all of this pretty well, I’d like to include the code below:

Demo-Srv

configuration New_xDscPullServer
{ 
    param  
    ( 
            [string[]]$NodeName = 'localhost', 


            [Parameter(Mandatory)]
            [ValidateNotNullOrEmpty()]
            [string] $RegistrationKey 
     ) 


     Import-DSCResource -ModuleName xPSDesiredStateConfiguration
     Import-DSCResource –ModuleName PSDesiredStateConfiguration

     Node $NodeName 
     { 
         WindowsFeature DSCServiceFeature 
         { 
             Ensure = 'Present'
             Name   = 'DSC-Service'             
         } 

         xDscWebService PSDSCPullServer 
         { 
             Ensure                   = 'Present' 
             EndpointName             = 'PSDSCPullServer' 
             Port                     = 8080 
             PhysicalPath             = "$env:SystemDrive\inetpub\PSDSCPullServer" 
             CertificateThumbPrint    = "AllowUnencryptedTraffic"   
             ModulePath               = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" 
             ConfigurationPath        = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration" 
             State                    = 'Started'
             DependsOn                = '[WindowsFeature]DSCServiceFeature'     
             UseSecurityBestPractices = $false
         } 
         

        File RegistrationKeyFile
        {
            Ensure          = 'Present'
            Type            = 'File'
            DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
            Contents        = $RegistrationKey
        }
    }
}

New_xDscPullServer -RegistrationKey e7336293-4341-45c1-b18e-f5420d105b48

NOTE: Please do not use this guid; PowerShell has a great function called (very aptly):
New-Guid
Be sure to generate a new guid before you deploy this.

This sets up the DSC pull server. It should be noted that the CertificateThumbPrint MUST be AllowUnencryptedTraffic exactly if you dont plan to use SSL.

Second, the webservice configuration for pulling:

Configuration webservice
{
    param ($MachineName)
        Node $MachineName
        {
                #Install the IIS Role
                WindowsFeature IIS
                {
                    Ensure = "Present"
                    Name = "Web-Server"
                }
                #Install ASP.NET 4.5
                WindowsFeature ASP
                {
                    Ensure = "Present"
                    Name = "web-Asp-Net45"
                }
        }
}

webservice -MachineName localhost

Dont forget the New-DscChecksum function on the mof file.

Demo-Client:

[DSCLocalConfigurationManager()]
configuration PullClientConfigID
{
    Node localhost
    {
        Settings
        {
            RefreshMode          = 'Pull'
            RefreshFrequencyMins = 30 
            RebootNodeIfNeeded   = $true
            ConfigurationMode = "ApplyAndAutoCorrect"

        }

        ConfigurationRepositoryWeb PullSrv
        {
            ServerURL          = 'http://demo-srv:8080/PSDSCPullServer.svc'
            RegistrationKey    = 'e7336293-4341-45c1-b18e-f5420d105b48'
            ConfigurationNames = @('webservice')
            AllowUnsecureConnection = $true
        }   
        ReportServerWeb ReptSrv
        {
            ServerURL          = 'http://demo-srv:8080/PSDSCPullServer.svc'
            RegistrationKey    = 'e7336293-4341-45c1-b18e-f5420d105b48'
            AllowUnsecureConnection = $true

        }


    }
}

PullClientConfigID 

And finally, the quick reporting server query:

function GetReport
{
    param($AgentId = "$((glcm).AgentId)", $serviceURL = "http://demo-srv:8080/PSDSCPullServer.svc")
    $requestUri = "$serviceURL/Nodes(AgentId= '$AgentId')/Reports"
    $request = Invoke-WebRequest -Uri $requestUri  -ContentType "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" `
               -UseBasicParsing -Headers @{Accept = "application/json";ProtocolVersion = "2.0"} `
               -ErrorAction SilentlyContinue -ErrorVariable ev
    $object = ConvertFrom-Json $request.content
    return $object.value
}


$results = GetReport #test comment
$byDate = $results | Sort-Object {$_."EndTime" -as  [DateTime] } -Descending
Write-Output $byDate[0].StatusData | ConvertFrom-Json

Again; this is just a very quick runthrough setting up a DSC pull server and the reporting component. Please don’t do a copy&paste deployment (read: use HTTPS).

Anyways; let me know if you need any help setting up a DSC Pull Server or anything related!