在尝试使用所需状态配置调试问题时,我发现以下命令非常有用;
start-dscconfiguration -wait -verbose -useexisting
这将(显然)允许查看所有详细日志。
问题是,如果服务器需要重新启动作为配置的一部分,或者 - 更重要的是 - 它正常运行(例如,作为拉配置的一部分是非交互式的),查看这些日志并不容易。
有没有办法将/ exact / same输出记录到特定位置?
我在其中一个答案中建议的C:\Windows\system32\configuration\configurationstatus
文件夹中没有任何.json文件?
在元配置中将RebootNodeIfNeeded
设置为false:
[DscLocalConfigurationManager()]
configuration Settings
{
Settings
{
ActionAfterReboot = 'StopConfiguration'
RebootNodeIfNeeded = $false
}
}
并再次运行现有配置:
Start-DscConfiguration -Wait -UseExisting -Verbose
(为后代添加此内容,因为其他答案仅包含链接。)来源:http://nanalakshmanan.com/blog/DSC-get-job-details-post-reboot/
您可以按照此博客中列出的步骤获取重启http://nanalakshmanan.com/blog/DSC-get-job-details-post-reboot/后的结果
您还可以按照此博客http://nanalakshmanan.com/blog/Historical-Job-Logs/中的说明查看历史作业日志