1

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:

$secpasswd = ConvertTo-SecureString “PASSWORD” -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential (“SERVUSER”, $secpasswd)

[DSCLocalConfigurationManager()]
configuration PullClientConfig
{
    param(
    [PSCredential]$DomainCredential
)

    Node 'localhost'
    {
        Settings
        {
            RefreshMode = 'Pull'
            RefreshFrequencyMins = 30
            RebootNodeIfNeeded = $false
            ConfigurationID = '2fda9b6d-e1be-46a9-8b92-e25cb17026cd'

        }

         ConfigurationRepositoryShare SmbConfigShare
        {
            SourcePath = '\\SERVER\SHARE'
            Credential = $mycreds
        }

        ResourceRepositoryShare SmbResourceShare
        {
            SourcePath = '\\SERVER\SHARE'
            Credential = $mycreds

        }
    }
}
$cd = @{
    AllNodes = @(
        @{
            NodeName = 'localhost'
            PSDscAllowPlainTextPassword = $true
        }
    )
}

My HelloWord config:

Configuration HelloWorld {

    param (
        [string[]]$ComputerName = "localhost" # i have changed this parameter to the servername
    )

    # Import the module that contains the File resource.
    Import-DscResource -ModuleName PsDesiredStateConfiguration

    # The Node statement specifies which targets to compile MOF files for, when this configuration is executed.
    Node $ComputerName {

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

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...

1 Answer 1

0

It was The ConfigurationMode, which had to be set under Settings in DSCLocalConfigurationManager to ApplyAndAutocorrect!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .