DSC-Node not pulling config

my DSC node is not pulling the DSC config from my SMB DSC server. Get-DSCConfigurationStatus says the pull was successfull but Get-DSCConfiguration remains the same(old config).

Im testing it with a HelloWorld config where a file is created on the C drive. When i delete the file Get-DSCConfiguration says “Enusre: absent” but when it pulls the new config, it should be “ensure: present”. I have no errors or anything else. Idk why it isn’t pulling correctly.

My DSC LCM config:

<span class="pln">$secpasswd </span><span class="pun">=</span> <span class="typ">ConvertTo</span><span class="pun">-</span><span class="typ">SecureString</span> <span class="pun">“</span><span class="pln">PASSWORD</span><span class="pun">”</span> <span class="pun">-</span><span class="typ">AsPlainText</span> <span class="pun">-</span><span class="typ">Force</span><span class="pln">
$mycreds </span><span class="pun">=</span> <span class="typ">New</span><span class="pun">-</span><span class="typ">Object</span> <span class="typ">System</span><span class="pun">.</span><span class="typ">Management</span><span class="pun">.</span><span class="typ">Automation</span><span class="pun">.</span><span class="typ">PSCredential</span> <span class="pun">(“</span><span class="pln">SERVUSER</span><span class="pun">”,</span><span class="pln"> $secpasswd</span><span class="pun">)</span>

<span class="pun">[</span><span class="typ">DSCLocalConfigurationManager</span><span class="pun">()]</span><span class="pln">
configuration </span><span class="typ">PullClientConfig</span>
<span class="pun">{</span><span class="pln">
    param</span><span class="pun">(</span>
    <span class="pun">[</span><span class="typ">PSCredential</span><span class="pun">]</span><span class="pln">$DomainCredential
</span><span class="pun">)</span>

    <span class="typ">Node</span> <span class="str">'localhost'</span>
    <span class="pun">{</span>
        <span class="typ">Settings</span>
        <span class="pun">{</span>
            <span class="typ">RefreshMode</span> <span class="pun">=</span> <span class="str">'Pull'</span>
            <span class="typ">RefreshFrequencyMins</span> <span class="pun">=</span> <span class="lit">30</span>
            <span class="typ">RebootNodeIfNeeded</span> <span class="pun">=</span><span class="pln"> $false
            </span><span class="typ">ConfigurationID</span> <span class="pun">=</span> <span class="str">'2fda9b6d-e1be-46a9-8b92-e25cb17026cd'</span>

        <span class="pun">}</span>

         <span class="typ">ConfigurationRepositoryShare</span> <span class="typ">SmbConfigShare</span>
        <span class="pun">{</span>
            <span class="typ">SourcePath</span> <span class="pun">=</span> <span class="str">'\\SERVER\SHARE'</span>
            <span class="typ">Credential</span> <span class="pun">=</span><span class="pln"> $mycreds
        </span><span class="pun">}</span>

        <span class="typ">ResourceRepositoryShare</span> <span class="typ">SmbResourceShare</span>
        <span class="pun">{</span>
            <span class="typ">SourcePath</span> <span class="pun">=</span> <span class="str">'\\SERVER\SHARE'</span>
            <span class="typ">Credential</span> <span class="pun">=</span><span class="pln"> $mycreds

        </span><span class="pun">}</span>
    <span class="pun">}</span>
<span class="pun">}</span><span class="pln">
$cd </span><span class="pun">=</span> <span class="pun">@{</span>
    <span class="typ">AllNodes</span> <span class="pun">=</span> <span class="pun">@(</span>
        <span class="pun">@{</span>
            <span class="typ">NodeName</span> <span class="pun">=</span> <span class="str">'localhost'</span>
            <span class="typ">PSDscAllowPlainTextPassword</span> <span class="pun">=</span><span class="pln"> $true
        </span><span class="pun">}</span>
    <span class="pun">)</span>
<span class="pun">}</span>

My HelloWord config:

<span class="typ">Configuration</span> <span class="typ">HelloWorld</span> <span class="pun">{</span><span class="pln">

    param </span><span class="pun">(</span>
        <span class="pun">[</span><span class="pln">string</span><span class="pun">[]]</span><span class="pln">$ComputerName </span><span class="pun">=</span> <span class="str">"localhost"</span> <span class="com"># i have changed this parameter to the servername</span>
    <span class="pun">)</span>

    <span class="com"># Import the module that contains the File resource.</span>
    <span class="typ">Import</span><span class="pun">-</span><span class="typ">DscResource</span> <span class="pun">-</span><span class="typ">ModuleName</span> <span class="typ">PsDesiredStateConfiguration</span>

    <span class="com"># The Node statement specifies which targets to compile MOF files for, when this configuration is executed.</span>
    <span class="typ">Node</span><span class="pln"> $ComputerName </span><span class="pun">{</span>

        <span class="com"># The File resource can ensure the state of files, or copy them from a source to a destination with persistent updates.</span>
        <span class="typ">File</span> <span class="typ">HelloWorld</span> <span class="pun">{</span>
            <span class="typ">DestinationPath</span> <span class="pun">=</span> <span class="str">"C:\HelloWorld.txt"</span>
            <span class="typ">Ensure</span> <span class="pun">=</span> <span class="str">"Present"</span>
            <span class="typ">Contents</span>   <span class="pun">=</span> <span class="str">"Hello World from DSC!"</span>
        <span class="pun">}</span>
    <span class="pun">}</span>
<span class="pun">}</span>

Update-DScConfiguration says that there is no newer config, so it wont pull. Do i understand DSC Right it has a config and the node trys to suit this config. So it basicaly has to pull a config again and apply it, instead it keeps the old config, refuses to pull. But the old config is wrong… i dont get it…

What is the ConfigurationMode. Can you post the Get-DscLocalConfigurationManager output here.

ActionAfterReboot : ContinueConfiguration
AgentId : 99F3DD1B-806C-11E9-80F3-005056A42D99
AllowModuleOverWrite : False
CertificateID :
ConfigurationDownloadManagers : {[ConfigurationRepositoryShare]SmbConfigShare}
ConfigurationID : 2fda9b6d-e1be-46a9-8b92-e25cb17026cd
ConfigurationMode : ApplyAndMonitor
ConfigurationModeFrequencyMins : 15
Credential :
DebugMode : {NONE}
DownloadManagerCustomData :
DownloadManagerName :
LCMCompatibleVersions : {1.0, 2.0}
LCMState : Idle
LCMStateDetail :
LCMVersion : 2.0
StatusRetentionTimeInDays : 10
SignatureValidationPolicy : NONE
SignatureValidations : {}
MaximumDownloadSizeMB : 500
PartialConfigurations :
RebootNodeIfNeeded : False
RefreshFrequencyMins : 30
RefreshMode : Pull
ReportManagers : {}
ResourceModuleManagers : {[ResourceRepositoryShare]SmbResourceShare}
PSComputerName :

 

I have set it now to ApplyAndAutoCorrect. Okay it does work now thank you :slight_smile: