DSC Configuration Keeps Restarting

眉间皱痕 提交于 2019-12-11 11:27:02

问题


I have my LocalConfigurationManager set up as follows:

[DSCLocalConfigurationManager()]
Configuration LCMConfig
{
    Node localhost
    {
        Settings
        {
            RebootNodeIfNeeded = $true
            ActionAfterReboot = 'ContinueConfiguration'
            AllowModuleOverwrite = $true
            DebugMode = 'All'
        }
    }
}
LCMConfig
Set-DscLocalConfigurationManager -Path .\LCMConfig -Verbose -Force

Then I kick off a DSC Configuration via

Start-DscConfiguration -Path .\RDS -Verbose -Wait

This configuration sets up an RemoteApp server which involves a whole bunch of steps and several reboots. One of those reboots is happening in a loop over and over again. When the reboot happens, I can get into the system long enough to run a quick command or two before DSC restarts the system again. How can I tell what specific Resource in the Configuration that DSC is getting hung up on.

If I run

Remove-DSCConfiguration -Stage Pending,Current,Previous

the reboots stop...but then I seem to lose all information on where the problem is happening.

I can capture the output of Get-DSCConfiguration, but I can't make sense enough of the output to tell where the reboot loop is happening.

How can I further debug this?


回答1:


There are many ways to troubleshoot this issue:

  1. Set RebootNodeIfNeeded to true and ActionAfterReboot to StopConfiguration. This way when the machine is up after reboot DSC won't automatically apply the configuration. Then you can, from powershell console, run: Start-DscConfiguration -UseExisting -wait -verbose to capture the verbose messages. The last resource that gets executed is the one that requested the reboot.

  2. Run Get-DscConfigurationStatus cmdlet to get the status of the last configuration run. This cmdlet will fail if something else is already running in DSC. It will give you list of resources that are in desired state and not in desired state. It will also give JobId for the operation. Search for %windir%\system32\Configuration\ConfigurationStatus\{JobId}*.json. This json file contains the verbose messages for the configuration run. This will run only with WMF 5.0 RTM.

  3. Get xDSCDiagnostics module and use the info from this blog to troubleshoot. https://blogs.msdn.microsoft.com/powershell/2014/02/11/dsc-diagnostics-module-analyze-dsc-logs-instantly-now/



来源:https://stackoverflow.com/questions/36535306/dsc-configuration-keeps-restarting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!