Trouble-shooting DSC and Configurations
Configurations can be difficult to troubleshoot and debug, because they're always running "behind the scenes" on a remote computer. Even worse, the remote computer isn't running your configuration script per se - it's going through a MOF file, and then running DSC resources to implement the instructions in the MOF. It's a lot of moving parts.
Fortunately, the DSC engine writes a lot of info into the Windows event logs. Specifically, you'll find the logs under Applications and Services Logs / Microsoft / Windows / Desired State Configuration. You'll need to right-click a folder in the event viewer to enable the Analytic and Debug logs; otherwise, you'll just see the Operational log. From PowerShell, you can run:
Get-WinEvent -LogName "Microsoft-Windows-Dsc/Operational"
To view the contents of the Operational log on the local computer. To enable the Analytic and Debug logs from the command-line:
Wevtutil.exe set-log "Microsoft-Windows-Dsc/Analytic" /q:true /e:true Wevtutil.exe set-log "Microsoft-Windows-Dsc/Debug" /q:true /e:true
The Operational log contains error messages, and is a good place to start troubleshooting. The Analytic log has more detailed messages, and any verbose messages produced by the DSC engine. The Debug log contains developer-level messages that might not be useful unless you're working with Microsoft Product Support to troubleshoot a problem. For more information on using these logs, visit http://blogs.msdn.com/b/powershell/archive/2014/01/03/using-event-logs-to-diagnose-errors-in-desired-state-configuration.aspx.
Wave 2 of the DSC Resource Kit includes an xDscDiagnostics module, which you can use to help analyze DSC failures. There are two commands in the module: Get-xDscOperation and Trace-xDscOperation. For a quick walkthrough of using these commands, visit http://blogs.msdn.com/b/powershell/archive/2014/02/11/dsc-diagnostics-module-analyze-dsc-logs-instantly-now.aspx.