Apply DSC Config (Push) with reboot required. Output?

Welcome Forums DSC (Desired State Configuration) Apply DSC Config (Push) with reboot required. Output?

This topic contains 3 replies, has 3 voices, and was last updated by

7 months ago.

  • Author
  • #108506

    Points: 0
    Rank: Member

    So I'm working on a PS Script to stand up new servers in our department.  That is working great so far!

    My question is this.  When applying a DSC Config (via Push) and it requires the box to restart, is there anyway to make the PS script sit there and wait, and reconnect to show me the rest of the output?  It seems after the reboot, the config automagically kicks in again, so that's not the problem.  The problem is there can be no "I'm Done!" message to the person running the script if the reboot kicks off, and it does the rest under the covers.

    Anyone have a solution for this?

    The config is being kicked off as follows:

    Start-DscConfiguration -ComputerName $ScriptComputerName -Path $configurationLocation -Wait -Force -Verbose

  • #108668

    Points: 1,634
    Helping Hand
    Rank: Community Hero

    You can use the DSC analytic logs to get the status.

    you will have to enable it in the target system.

    wevtutil.exe set-log “Microsoft-Windows-Dsc/Analytic” /q:True /e:true

    once enabled, you can query it using Get-WinEvent cmdlet.

    Get-WinEvent-ComputerName DestServerA “Microsoft-Windows-Dsc/Analytic” -Oldest

    The message property is as is what is printing in the console.

  • #109850

    Points: 0
    Rank: Member

    I ended up adding a SendEmail DSC Resource to just send out an email message when the config was complete.  This seems to be doing the trick for the moment, but I'll definitely look into this as well.  Thanks!

  • #109859

    Points: 0
    Rank: Member

    A one off possibility...

    When the compute restarts being doing a Test-NetConnection until the serve comes back online. When the computer comes back online you can then do a Test-DscConfiguration to verify the server is compliant with your configuration. This will give a bit cleaner output than trying to pull the event logs.

The topic ‘Apply DSC Config (Push) with reboot required. Output?’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort