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

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Paul DeArment Jr Paul DeArment Jr 3 weeks, 4 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #53195

    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

    #53238
    Profile photo of Paul DeArment Jr
    Paul DeArment Jr
    Participant

    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.

    • This reply was modified 3 weeks, 4 days ago by Profile photo of Paul DeArment Jr Paul DeArment Jr. Reason: Accidentally hit submit while distracted by coworkers
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.