Skip to content

Instantly share code, notes, and snippets.

@signalwarrant
Created March 9, 2021 19:21
Show Gist options
  • Select an option

  • Save signalwarrant/cf6893a83f90625587c34c0cc3cde841 to your computer and use it in GitHub Desktop.

Select an option

Save signalwarrant/cf6893a83f90625587c34c0cc3cde841 to your computer and use it in GitHub Desktop.
LCMPush.ps1
# Get all the DSC CMDLets
Get-Command -Noun dsc*
# Get Available Resources
# Refer to powershellgallery.com for additional resources
Get-DscResource
# What can we configure for each resource
Get-DscResource File | Select -ExpandProperty Properties
# Step 1
# Generate a LCM Config for target node
# Target Node LCM Configuration
Configuration LCMConfig {
# Parameters
Param([string[]]$ComputerName = "localhost")
# Target Node
Node $ComputerName {
# LCM Resource
LocalConfigurationManager {
ConfigurationMode = "ApplyAndAutoCorrect"
ConfigurationModeFrequencyMins = 30
}
}
}
# Generate MOF File
LCMConfig -ComputerName EXCH
# Check LCM Settings on target node
Get-DscLocalConfigurationManager -CimSession EXCH
# Apply the LCMConfig for each Target Node
Set-DscLocalConfigurationManager -Path LCMConfig
# Check the LCM Config again
# Notice the CoConfigurationModeFrequencyMins value changed to 30
Get-DscLocalConfigurationManager -CimSession EXCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment