Error when using update-dscconfiguration

Tagged: 

This topic contains 5 replies, has 2 voices, and was last updated by Profile photo of Arnold Arnold 3 weeks, 6 days ago.

  • Author
    Posts
  • #69559
    Profile photo of Dylan De Smedt
    Dylan De Smedt
    Participant

    I am having a problem with the update-dscconfiguration. I can register my node to the pullserver but it won't get the configurationfile. I think this is caused by the same issue of update-dscconfiguration with the following error:
    The attempt to 'get an action' for AgentId 153B0A2D-2A68-11E7-9662-000C2936433B from server URL https://d
    sc-server///PsDscPullserver.svc/Nodes(AgentId='153B0A2D-2A68-11E7-9662-000C2936433B')/GetDscAction
    failed with server error 'ResourceNotFound(404)'.
    For further details see the server error message below or the DSC debug event log with ID 4339.
    ServerErrorMessage:- 'The assigned configuration 'Webservice' is not found in the pull server
    configuration repository.'

    I'm Working with a HTTPS pullserver with WMF5.

    Pullserver script:
    Configuration PullServer {
    param
    (
    [string[]]$computerName = "localhost",
    [ValidateNotNullOrEmpty()]
    [string]$certificateThumbPrint,
    [ValidateNotNullOrEmpty()]
    [string]$RegistrationKey
    )
    Import-DSCResource -ModuleName xPSDesiredStateConfiguration
    Import-DSCResource -ModuleName PSDesiredStateConfiguration

    # Load the Windows Server DSC Service feature
    Node $computerName
    {
    WindowsFeature DSCServiceFeature
    {
    Ensure = 'Present'
    Name = 'DSC-Service'
    }

    # Use the DSC Resource to simplify deployment of the web service
    xDSCWebService PSDSCPullServer
    {
    Ensure = 'Present'
    EndpointName = 'PSDSCPullServer'
    Port = 443
    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'
    UseSecurityBestPractices = $false
    }

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

    }

    #$guid = [guid]::NewGuid()
    $guid = 'regkey'
    $cert = Get-ChildItem Cert:\LocalMachine\My
    $filepath = 'C:\Program Files\WindowsPowerShell\DscService\Configuration\PullServer\'
    PullServer -RegistrationKey $guid -certificateThumbPrint $cert.Thumbprint -OutputPath $filepath
    New-DscChecksum -Path $filepath
    Start-DscConfiguration -Path $filepath -wait -Verbose -Force

    LCM configuration file:
    [DSCLocalConfigurationManager()]

    Configuration LCM_Pull {

    Node localhost {

    Settings {
    ConfigurationMode = 'ApplyAndAutoCorrect'
    RefreshMode = 'Pull'
    ConfigurationModeFrequencyMins = 15
    RebootNodeIfNeeded = $true
    }

    ConfigurationRepositoryWeb PullServer {
    ServerURL = 'https://DSC-Server/PsDscPullserver.svc'
    AllowUnsecureConnection = $false
    RegistrationKey = 'regkey'
    ConfigurationNames = @('Webservice')
    }

    ResourceRepositoryWeb PullServerModules {
    ServerURL = 'https://DSC-Server/PsDscPullserver.svc'
    AllowUnsecureConnection = $false
    RegistrationKey = 'regkey'
    }
    }
    }

    LCM_Pull -OutputPath "$env:SystemDrive\DscConfiguration\"
    Set-DscLocalConfigurationManager -Path "$env:SystemDrive\DscConfiguration\" -Verbose -ComputerName localhost -Force

  • #69565
    Profile photo of Arnold
    Arnold
    Participant

    In your Example it seems that you use a configuration names in your LCM Script.
    So make sure that on your pull server your mof and checksum have the same name like your configuration names.

    In /dsc/configurations/, you should have this files Webservice.mof and .checksum .

    Thank's

    • #69567
      Profile photo of Dylan De Smedt
      Dylan De Smedt
      Participant

      Hello Arnold,

      I got the folder 'Webservice' located at C:\Program Files\WindowsPowershell\DscService\Configuration.
      This folder contains both 'Webservice.mof' and the 'Webservice.mof.checksum' file.

      I can't seem to find the solution, Thanks in advance!

    • #69568
      Profile photo of Arnold
      Arnold
      Participant

      copy the content of your folder and paste them directly in C:\Program Files\WindowsPowershell\DscService\Configuration

      It should work

    • #69573
      Profile photo of Dylan De Smedt
      Dylan De Smedt
      Participant

      Thanks so much this works! I've been looking for ages!

    • #69576
      Profile photo of Arnold
      Arnold
      Participant

      You are welcome. 😉

You must be logged in to reply to this topic.