How can I update the configuration of the LCM without over-writing it

Welcome Forums DSC (Desired State Configuration) How can I update the configuration of the LCM without over-writing it

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
3 weeks ago.

  • Author
    Posts
  • #179025

    Participant
    Topics: 11
    Replies: 4
    Points: 84
    Rank: Member

    Hello

    I read a blog post which said if I want to set the DebugMode setting on the LCM I can so the following

    [DSCLocalConfigurationManager()]
    Configuration LCMDebugMode {
        Node localhost {
            Settings {
                ConfigurationMode    = 'ApplyOnly'
                RefreshMode          = 'Push'
                Debugmode            = 'ForceModuleImport'
            }
        }
    }
    
    LCMDebugMode -OutputPath $directoryPath
    Set-DscLocalConfigurationManager -Path $directoryPath -Verbose
    Get-DscLocalConfigurationManager
    The above works but it over-writes my original LCM configuration (e.g. pull server address and all the other settings)
    I use Azure Automation DSC (so there are several settings related to Azure when you display the LCM settings like so (I changed the GUID slightly)
    ActionAfterReboot              : ContinueConfiguration
    AgentId                        : 4B402719-D940-11E9-953E-00156D016FB7
    AllowModuleOverWrite           : True
    CertificateID                  :
    ConfigurationDownloadManagers  : {[ConfigurationRepositoryWeb]AzureAutomationDSC}
    ConfigurationID                :
    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                 : {[ReportServerWeb]AzureAutomationDSC}
    ResourceModuleManagers         : {[ResourceRepositoryWeb]AzureAutomationDSC}
    PSComputerName                 :
    When I run your command at the top of this email it works then when I do get-dscConfiguration again I get the following
    ActionAfterReboot              : ContinueConfiguration
    AgentId                        : 4B402719-D640-11E9-953E-00155D016FB7
    AllowModuleOverWrite           : False
    CertificateID                  :
    ConfigurationDownloadManagers  : {}
    ConfigurationID                :
    ConfigurationMode              : ApplyOnly
    ConfigurationModeFrequencyMins : 15
    Credential                     :
    DebugMode                      : {ForceModuleImport}
    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                    : Push
    ReportManagers                 : {}
    ResourceModuleManagers         : {}
    PSComputerName                 :
    See how all my other settings related to Azure etc have gone.
    Therefore I  need to know how to switch on/off the various DebugMode options in LCM without over-writing my original settings each time. Alternatively, will I have to add several more settings to the above PowerShell code (key-value pairs) relative to Azure settings, etc and if so which ones from the above, please
    Thanks
    Charlie
  • #179571

    Senior Moderator
    Topics: 8
    Replies: 1085
    Points: 3,651
    Helping Hand
    Rank: Community Hero

    If you goal is to debug, then you can use Enable-DSCDebug cmdlet do that without changing LCM setting, but If the goal is to apply a subset of LCM setting, you will have to somehow get the current LCM setting and add the new setting to it and re apply.

  • #180321

    Participant
    Topics: 11
    Replies: 4
    Points: 84
    Rank: Member

    Thanks for taking the time to get back to me on this one  kvprasoon, much appreciated

    CXMelga

You must be logged in to reply to this topic.