I'm writing a DSC to configure the Local Configuration manager, and it's exiting with the error below. In addition, when I do add the -force
flag (as is recomended by the error), instead of helping the situation, the PowerShell session hangs, and won't recover until I try running the same DSC file from a different PS session, also with the force option, which will in turn hang in it's place. Running with Administrative rights doesn't change this.
This is the second time I'm having issues with Powershell DSC simply hanging and not exiting even with ctrl+break and ctrl+c, is this a common issue?
Here's the error:
Cannot invoke the Set-DscLocalConfigurationManager cmdlet. The Set-DscLocalConfigurationManager cmdlet is in progress
and must return before Set-DscLocalConfigurationManager can be invoked. Use -Force option if that is available to
cancel the current operation.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : localhost
Here's a copy of my DSC:
[DSCLocalConfigurationManager()]
Configuration LCMConfig
{
Node "localhost" # Since all vm's should be pulling or pushing or doing it at the same frequencey.
{
Settings {
ConfigurationMode = 'ApplyAndMonitor' # Maybe we'd want 'ApplyAndAutoCorrect' at some point.
RefreshFrequencyMins = 30 # Interval for checking the pull server
ConfigurationModeFrequencyMins = 30
RebootNodeIfNeeded = $true
ActionAfterReboot = "ContinueConfiguration" # This is the default but good to see explicitly.
RefreshMode = 'Push'
}
}
}
LCMConfig -OutputPath $PSScriptRoot
Set-DscLocalConfigurationManager -Path $PSScriptRoot -Verbose
Get-DscLocalConfigurationManager