Fixing a stuck DSC run

You may come across a situation where a DSC configuration run has been executed but failed at some point in the process. Perhaps you have fixed the problem or simply want to run it again, but DSC provides the following error:

Cannot invoke the SendConfigurationApply method.
The SendConfigurationApply method is in progress and must return
before SendConfigurationApply can be invoked.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName: box1

This means that DSC thinks there is an execution run currently in progress and it's trying to protect you by not running another execution run. If more than one execution is allowed to run at the same time, then DSC cannot guarantee that the desired state is in effect. So, we need to tell DSC to ignore the failed last run and start a new one. We do this by following the same procedure to refresh the DSC cache with one additional step. We also remove the pending.mof file so that DSC does not have any record of a past run that failed. Don't worry; the last run is still recorded for the target node's state if you set up the DSC compliance server part of the DSC pull server, as shown here:

[PS]> Remove-Item $env:systemRoot/system32/configuration/pending.mof -Force;
[PS]> Get-Process *wmi* | Stop-Process -Force;
[PS]> Restart-Service winrm -Force

In WMF5, we could use Start-DSCConfiguration -Force to avoid having to do this.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset