Trigger a consistency check

This topic contains 5 replies, has 5 voices, and was last updated by  Micky Balladelli 2 years, 3 months ago.

  • Author
    Posts
  • #26673

    Joe
    Participant

    Hi,

    I have a target svr that is configured as a pull client and the LCM runs the consistency check at the configured interval, but I was wondering if there is anyway I could manually trigger the consistency check from powershell? Right now I do this by triggering the consistency scheduled task, but I'm not sure if this is recommend.

    Start-ScheduledTask -TaskPath '\Microsoft\Windows\Desired State Configuration' -TaskName 'Consistency' -Verbose

    Thanks

  • #26705

    Don Jones
    Keymaster

    See "The DSC Book" (Resources menu / eBooks on this website). There's a WMI call you can make to rigger it. You need to be a bit careful in doing so; there's a reason the minimum interval is 15min. Make sure a check isn't already running before triggering another one.

  • #26713

    Joe
    Participant

    Hi Don,

    Sorry for being a pain, but I wasnt able to find that in the dsc book. Do you know the chapter by any chance?

    Thanks

  • #26736

    Palmar
    Participant

    If you have a recent version of WMF (I think this one was in the november preview) you can use the cmdlet "update-dscconfiguration"

  • #26803

    Zuldan
    Participant

    Hi Joe, to force a consistency check you can use the following

    Invoke-CimMethod -CimSession MyComputerName -Name PerformRequiredConfigurationChecks -Namespace root/Microsoft/Windows/DesiredStateConfiguration -Arguments @{Flags=[Uint32]2} -ClassName MSFT_DscLocalConfigurationManager -Verbose

    Update-DscConfiguration will only perform a consistency check if the MOF file checksum fails and a new configuration is brought down

  • #26869

    Micky Balladelli
    Participant

    I use Test-DscConfiguration -cimsession -verbose

    It will return whether the remote node(s) is(are) in the desired configuration by triggering the Test-TargetResource function of all the resources in the configuration. The verbose param is quite useful.

    Is this what you were looking for?

You must be logged in to reply to this topic.