Skip navigation
config

Configure PowerShell DSC Local Configuration Manager Refresh

Q: How can I control how often Local Configuration Manager checks the Windows PowerShell Desired State Configuration for configuration drift?

A: Local Configuration Manager is the Windows PowerShell Desired State Configuration (DSC) engine. Once a PowerShell DSC has been applied to a server, Local Configuration Manager periodically checks whether the configuration is still valid or if drift has occurred. If the ConfigurationMode property is set to ApplyAndAutoCorrect, then at the configured interval, if drift has occurred, it will reapply the required configuration. To control how often this occurs, you need to create a configuration and apply it. For example, in the following code I set the interval to every 30 minutes (which is a multiple of the refresh frequency at which the server pulls configuration from the pull server, if it's configured in Pull mode).

Configuration DemoConfig
{
    Node "SAVDALHV01"
    {
        LocalConfigurationManager
        {
            ConfigurationMode = "ApplyAndAutoCorrect"
            ConfigurationModeFrequencyMins = 30 #must be a multiple of the RefreshFrequency and how often configuration is checked
            RefreshFrequencyMins = 15  #15 is minimum and this is how often configuration is pulled from pull server
        }
    }
}

DemoConfig -OutputPath "C:\Users\administrator\dsc"

Set-DscLocalConfigurationManager -Path "C:\Users\administrator\dsc" -Verbose

Get-DscLocalConfigurationManager
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish