How to tell if dsc has finished 'running'/'applying'

Hi,

What is the canonical way of knowing the mof has been applied successfully / unsuccessfully / still in progress.

I can tell that the mof has been applied because all the stuff is there on the machine (packages installed, files created, etc)
But I can’t find a way to track progress/completion.

I run everything on one machine:
smb share “C:/DscSmbShare/dsc”
LCM SourcePath = ‘C:\DscSmbShare\dsc’
build the mof (again on the same machine).
Update-DscConfiguration -verbose on the same myMachine returns:

PS C:\Users\Administrator> Update-DscConfiguration -Verbose Id Name PSJobTypeName State HasMoreData Location Command -- ---- ------------- ----- ----------- -------- ------- 5 Job5 Configuratio... Running True localhost Update-DscConfiguratio...

VERBOSE: Time taken for configuration job to complete is 0.215 seconds

But then whenever I run “Get-DscConfigurationStatus” on the node, I get:

Get-DscConfigurationStatus : Cannot invoke the Get-DscConfigurationStatus cmdlet. The Consistency Check or Pull cmdlet is in progress and must return before Get-DscConfigurationStatus can be invoked. Use -Force option if that is available to cancel the current operation. At line:1 char:1 + Get-DscConfigurationStatus + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (MSFT_DSCLocalConfigurationManager:root/Microsoft/...gurationManager) [Get -DscConfigurationStatus], CimException + FullyQualifiedErrorId : MI RESULT 1,Get-DscConfigurationStatus

unless I run “Stop-DscConfiguration”, which ruins it, and means I have to run Update-DscConfiguration again.

Thanks.

M

Try using Get-DscLocalConfigurationManager. If it returns idle for Lcmstate then it is currently not applying a configuration. Once that is idle you can then run your other commands. You can expand upon this idea by using a loop (do-while) to basically wait until its idle and then proceed.