§ August 20, 2014 14:42 by
beefarino |
DSC is like remoting – when it works it’s amazing. When it doesn’t work….. who knows why?
While prepping a Desired State Configuration demo for SQL Saturday #328, I hit a small roadblock that proved to waste several hours of my time. I’m documenting it here in the hopes that it helps someone else.
I’m using DSC to install SQL Server onto an Azure VM. At some point in the process, running Start-DscConfiguration started to error out, with a cryptic and altogether unhelpful message:
An old configuration is still pending. Please wait for the pending configuration to finish. If the problem persists,
execute Start-DSCConfiguration command with -Force parameter.
+ CategoryInfo : ResourceExists: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 11
+ PSComputerName : nottaken.cloudapp.net
This error persisted regardless of what I tried, and it eventually took a new form:
Cannot invoke the SendConfigurationApply method. The PerformRequiredConfigurationChecks method is in progress and must
return before SendConfigurationApply can be invoked.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : nottaken.cloudapp.net
I finally swallowed my pride and reached out to DSC trailblazer Steve Murawski, who was able to quickly and generously point me to the fix.
The Cause
In my case, it would seem that the DSC local service was hard at work on my target node trying to make things work. The problem was that DSC neglected a failed installer (or the resource in question failed to report it correctly). In any case, this left DSC in a state where it thought a configurable something is happening, and thus it should prevent new things from happening.
Specifically, I was trying to install SQL Server using xSqlPs, but the password I specified for sa did not meet the strong password requirements and the installation exited. For some reason I’m still investigating, the xSqlServerInstall resource failed to notice the error.
The Fix
To get DSC working again, I did the following steps, on the target machine,in this order:
- Delete c:\windows\system32\configuration\pending.mof;
- Stop all WMI processes;
- Restart the WinRM service;
The first step was the only one I hadn’t tried, because I didn’t know anything about that file. And it’s the key – that file tells DSC what needs to be done. If it isn’t there, DSC seems to think that everything is back to being cool.
The Code
Here is some code I’ve started using to automate the fix described above.
remove-item $env:systemRoot/system32/configuration/pending.mof -force;
get-process *wmi* | stop-process -force;
restart-service winrm -force
Good luck!