DSC 配置不断重启 [英] DSC Configuration Keeps Restarting

查看:51
本文介绍了DSC 配置不断重启的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 LocalConfigurationManager 设置如下:

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

然后我通过

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

此配置设置了一个 RemoteApp 服务器,其中涉及大量步骤和多次重启.其中一次重新启动一次又一次地循环发生.当重新启动时,我可以进入系统足够长的时间来运行一两个快速命令,然后 DSC 再次重新启动系统.我如何知道 DSC 挂断了配置中的哪些特定资源.

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.

如果我跑

Remove-DSCConfiguration -Stage Pending,Current,Previous

重新启动停止...但随后我似乎丢失了有关问题发生位置的所有信息.

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

我可以捕获 Get-DSCConfiguration 的输出,但我无法通过足够的输出来判断重启循环发生的位置.

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.

我该如何进一步调试?

推荐答案

有很多方法可以解决这个问题:

There are many ways to troubleshoot this issue:

  1. RebootNodeIfNeeded 设置为 true 并将 ActionAfterReboot 设置为 StopConfiguration.这样当机器在重启后启动时 DSC 不会自动应用配置.然后,您可以从 powershell 控制台运行:Start-DscConfiguration -UseExisting -wait -verbose 以捕获详细消息.执行的最后一个资源是请求重新启动的资源.

  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.

运行 Get-DscConfigurationStatus cmdlet 以获取上次配置运行的状态.如果其他东西已经在 DSC 中运行,则此 cmdlet 将失败.它将为您提供处于所需状态和未处于所需状态的资源列表.它还将为操作提供 JobId.搜索 %windir%\system32\Configuration\ConfigurationStatus\{JobId}*.json.此 json 文件包含配置运行的详细消息.这仅适用于 WMF 5.0 RTM.

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.

获取 xDSCDiagnostics 模块并使用此博客中的信息进行故障排除.https://blogs.msdn.microsoft.com/powershell/2014/02/11/dsc-diagnostics-module-analyze-dsc-logs-instantly-now/

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/

这篇关于DSC 配置不断重启的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆