DSC Pull server help

This topic contains 1 reply, has 1 voice, and was last updated by Profile photo of Greg Pero Greg Pero 1 year, 4 months ago.

  • Author
    Posts
  • #29114
    Profile photo of Greg Pero
    Greg Pero
    Participant

    Hello – Just started working with DSC – ran into a snag and haven't been able to find a solution searching the Interweb – would greatly appreciate some help or being pointed in the right direction.

    I have 2 virtual Windows 2012 R2 servers both running PS version 4.0 running in a lab environment. I am attempting to set up the DSC Pull Server Proof-of-Concept following the guide at:

    http://blogs.technet.com/b/privatecloud/archive/2014/08/08/desired-state-configuration-dsc-nodes-deployment-and-conformance-reporting-series-part-2-deploying-a-pull-service-endpoint-and-automating-the-configuration-of-the-dsc-nodes.aspx

    On the end node – i am getting a Event 4104, Desired State Configuration error when trying to pull from the pull server.
    ————————————————————————————————————
    Job{......}:
    This event indicates that failure happens when LCM is trying to get the configuration from pull server using download manager WebDownloadManager. ErrorDetail is The Attempt to get the action from server http://server1:8080///PullSvc/PSDSCPullServer.svc/Action(ConfigurationId='0335b1aa-3956-496d-9e1d-41ceda386b4f')/GetAction failed because a vaild configuration 0335b1aa-3956-496d-9e1d-41ceda386b4f cannot be found.
    ———————————————————————————————————————-

    The script i used to create the pull server is as follows:
    ———————————————————————————————————–
    configuration Sample_xDscWebService
    {
    param
    (
    [string[]]$NodeName = 'localhost',

    [ValidateNotNullOrEmpty()]
    [string] $certificateThumbPrint = "AllowUnencryptedTraffic"
    )

    Import-DSCResource -ModuleName xPSDesiredStateConfiguration

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

    WindowsFeature WinAuth
    {
    Ensure = "Present"
    Name = "web-Windows-Auth"
    }

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

    xDscWebService PSDSCComplianceServer
    {
    Ensure = "Present"
    EndpointName = "DscConformance"
    Port = 9090
    PhysicalPath = "$env:SystemDrive\inetpub\wwwroot\PSDSCComplianceServer"
    CertificateThumbPrint = "AllowUnencryptedTraffic"
    State = "Started"
    IsComplianceServer = $true
    DependsOn = @("[WindowsFeature]DSCServiceFeature","[WindowsFeature]WinAuth","[xDSCWebService]PSDSCPullServer")
    }
    }
    }

    Sample_xDscWebService -ComputerName "Server1"
    Start-DscConfiguration -Wait -Verbose .\Sample_xDscWebService
    —————————————————————————————————–

    The script ran successfully and created the "PullSvc" & "DscConformance" sites in IIS.

    I then ran the following script to configure the end-node:

    ——————————————————————————————
    Configuration TestConfig {

    Param(
    [Parameter(Mandatory=$True)]
    [String[]]$NodeGUID
    )

    Node $NodeGUID {

    File ScriptPresence {
    Ensure = "Present"
    Type = "Directory"
    Recurse = $True
    SourcePath = "\\Server1\Test"
    DestinationPath = "C:\Temp\DSCTest"
    }

    }
    }

    $Computers = @("Server2")

    write-host "Generating GUIDs and creating MOF files..."
    foreach ($Node in $Computers)
    {
    $NewGUID = [guid]::NewGuid()
    $NewLine = "{0},{1}" -f $Node,$NewGUID
    TestConfig -NodeGUID $NewGUID
    $NewLine | add-content -path "$env:SystemDrive\Program Files\WindowsPowershell\DscService\Configuration\dscnodes.csv"
    }

    write-host "Creating checksums..."
    New-DSCCheckSum -ConfigurationPath .\TestConfig -OutPath .\TestConfig -Verbose -Force

    write-host "Copying configurations to pull service configuration store..."
    $SourceFiles = (Get-Location -PSProvider FileSystem).Path + "\TestConfig\*.mof*"
    $TargetFiles = "$env:SystemDrive\Program Files\WindowsPowershell\DscService\Configuration"
    Move-Item $SourceFiles $TargetFiles -Force
    Remove-Item ((Get-Location -PSProvider FileSystem).Path + "\TestConfig\")
    ———————————————————————————————————————-

    The script ran successfully and created the "dscnodes.csv" – validated the correct entry inside. Also created "0335b1aa-3956-496d-9e1d-41ceda386b4f.mof" & "0335b1aa-3956-496d-9e1d-41ceda386b4f.mof.checksum"

    On the end-node "Server2" – I ran the following script:

    ———————————————————————————————–
    Configuration SimpleMetaConfigurationForPull
    {

    Param(
    [Parameter(Mandatory=$True)]
    [String]$NodeGUID
    )

    LocalConfigurationManager
    {
    ConfigurationID = $NodeGUID;
    RefreshMode = "PULL";
    DownloadManagerName = "WebDownloadManager";
    RebootNodeIfNeeded = $true;
    RefreshFrequencyMins = 15;
    ConfigurationModeFrequencyMins = 30;
    ConfigurationMode = "ApplyAndAutoCorrect";
    DownloadManagerCustomData = @{ServerUrl = "http://Server1.mycompany.com:8080/PullSvc/PSDSCPullServer.svc"; AllowUnsecureConnection = “TRUE”}
    }
    }

    $data = import-csv "\\server1.mycompany.com\c$\Program Files\WindowsPowershell\DscService\Configuration\dscnodes.csv" -header("NodeName","NodeGUID")

    SimpleMetaConfigurationForPull -NodeGUID ($data | where-object {$_."NodeName" -eq $env:COMPUTERNAME}).NodeGUID -Output "."
    $FilePath = (Get-Location -PSProvider FileSystem).Path + "\SimpleMetaConfigurationForPull"
    Set-DscLocalConfigurationManager -ComputerName "localhost" -Path $FilePath -Verbose
    ————————————————————————————————————————–

    The script ran successfully. On the end-node "Server2" – the Get-DscLocalConfigurationManager command returns the correct ConfigurationID, Mode, etc.

    When i run a Get-DscConfiguration – it returns "Current configuration does not exist."

    Am i missing something or – is this a permissions issue? Any help would be appreciated.

    Thanks ...

  • #29163
    Profile photo of Greg Pero
    Greg Pero
    Participant

    Got it working! Looked at the "Configure a Pull Server" section from the DSC Book. I blew away IIS on my lab Pull Server – reinstalled. Used the script from the DSC Book to recreate the websites. Ran the "Start-DscConfiguration ..." command. I used my original script to setup the end node. Only other thing that i changed is i didn't manually create the headers in the dscnodes.csv file. I ran just the import statement on the end node and viewed the contents of $data and noticed that the headers were listed twice.

You must be logged in to reply to this topic.