1

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 
AllTradesJack
  • 2,762
  • 5
  • 25
  • 36
  • 1
    I know the accepted answer on the linked duplicate didn't work, but see [Greg Bray's answer](http://stackoverflow.com/a/29291495/3905079). – briantist Jan 23 '17 at 23:42
  • @briantist Greg Bray's answer worked, thank you! Is there anyway I can mark this in my question? It seems like since it's a duplicate I can't provide an answer. – AllTradesJack Jan 24 '17 at 00:03
  • 1
    That's correct you can't provide an answer, but that's part of the point of marking questions as duplicates. It doesn't necessarily mean they're bad, it just means the answer can be found on the site already. A link to the other question is provided right at the top of this page for others who find this problem based on your question title and text. – briantist Jan 24 '17 at 00:35

0 Answers0