This topic contains 4 replies, has 2 voices, and was last updated by
November 25, 2015 at 4:05 am #32247
Bit of a strange one here, we're currently moving our development environment deployment from start-up script installation to DSC in a pull configuration on Server 2012 R2. We've got everything working in-terms of the configuration script and the pull server etc however we're trying to ensure that a machine is obviously "not ready" to login to until the DSC is finished applying.
Our original solution to this was to have a synchronous startup script that checks for the existance of "C:\Windows\System32\Configuration\Pending.mof" and while it's there just sleep and check again in 5 seconds. This *almost* works, except that the startup script executing appears to interfere with DSC's ability to reboot when it needs to. So, if I can change the loop to break out if DSC isn't applying then it'll presumably restart itself appropriately? This poses the question, how do I tell if it's currently applying stuff?!
November 25, 2015 at 7:49 am #32256KeymasterPoints: 2Rank: Member
Well... off the top of my head, I'm not sure you can. At least not in the fashion you're looking for. DSC's design ethos is all about "it'll eventually be configured" and it doesn't really have a lot of hooks for checking to see what it's up to at any given moment.
Why not set up a reporting server, let DSC report to it, and then periodically query that to see if the node has reported in as compliant?
November 25, 2015 at 8:02 am #32264
Thanks for the reply. We do have a compliance server currently, however it appears that the nodes are regarded as compliant once the pending.mof is present, not when the configuration is actually finished applying?
I was thinking about looking for a running WmiPrvSE process, however that appears to be always banging around. I suppose another option would be to look in the EventLog maybe?
November 25, 2015 at 8:15 am #32265KeymasterPoints: 2Rank: Member
No, that shouldn't be the case, unless DSC has already figured out that all the Tests returned $True. That's what you're seeing, though?
I think a better technique might be to create a short Script resource that tests to see if some flag file is present. Make it depend on everything else that you can, so that it runs last. When the file exists, it's done. Or... something else along that logic.
November 26, 2015 at 10:22 am #32310
We have discovered the answer to our original query, I believe that (Get-DscLocalConfigurationManager).LCMState holds the answer;
It can be Idle, Busy, PendingConfiguration, PendingReboot
The topic ‘Detecting if DSC is currently Applying’ is closed to new replies.