Introduction

The xDscDiagnostics module is a part of the Windows PowerShell Desired State Configuration (DSC) Resource Kit, which is a collection of DSC related artifacts produced by the PowerShell Team. This module contains two cmdlets: Get-xDscOperation and Trace-xDscOperation. These cmdlets help in reading the DSC event logs for any particular DSC operation. This further helps in identifying the causes of any failure in a DSC operation.

All of the resources in the DSC Resource Kit are provided AS IS, and are not supported through any Microsoft standard support program or service. The "x" in xDscDiagnostics stands for experimental, which means that these resources will be fix forward and monitored by the module owner(s).

Please leave comments, feature requests, and bug reports in the Q & A tab for this module.

If you would like to modify xDscDiagnostics module, feel free. When modifying, please update the module name and cmdlet names (instructions below). As specified in the license, you may copy or modify this resource as long as they are used on the Windows Platform.

For more information about Windows PowerShell Desired State Configuration, check out the blog posts on the PowerShell Blog (this is a good starting point). There are also great community resources, such as PowerShell.org, or PowerShell Magazine. For more information on the DSC Resource Kit, check out this blog post.

Installation

To install xDscDiagnostics module

To confirm installation:

Requirements

This module requires the latest version of PowerShell (v4.0, which ships in Windows 8.1 or Windows Server 2012R2). To easily use PowerShell 4.0 on older operating systems, install WMF 4.0. Please read the installation instructions that are present on both the download page and the release notes for WMF 4.0.

Description

The xDscDiagnostics module exposes two functions - Get-xDscOperation and Trace-xDscOperation that aid in diagnosing DSC errors. Here, we use the term DSC operation to indicate an execution of any DSC cmdlet from the start to its end. For instance, Start-DscConfiguration and Test-DscConfiguration would form two separate DSC operations. The cmdlets also let you diagnose operations run on other computers. More details about their usage is given below in the Details section.

Details

The functions and their parameters exposed by the module xDscDiagnostics are given below:

Renaming Requirements

When making changes to this module, we suggest the following practice:

  1. Update the following names by replacing MSFT with your company/community name and replacing the "x" with "c" (short for "Community") or another prefix of your choice:
    • Module name (ex: xDscDiagnostics becomes cDscDiagnostics)
    • Function Name (ex: Get-xDscOperation becomes Get-cDscOperation)
  2. Update module and metadata information in the module manifest
  3. Update any configuration that use these resources

We reserve function and module names without prefixes ("x" or "c") for future use (e.g. DscDiagnostics or Get-DscOperation). If the next version of Windows Server ships with a "DscDiagnostics" module, we don't want to break any configurations that use any community modifications. Please keep a prefix such as "c" on all community modifications.

Versions

1.0.0.0

Example: Display the status of last 20 DSC operations

This example will show how the last 20 DSC operations can be listed, to see if any of them failed . 
PowerShell
Edit|Remove
Get-xDscOperation -Newest 20

Example: Display the status of last 2 operations in computer XXYY after passing Credential $cred

This example lets you find the status of DSC operations run in another computer. 
Note: this requires a credential.
PowerShell
Edit|Remove
Get-xDscOperation -ComputerName Temp-Computer.domain.com -Credential $cred -Newest 2

Example: Trace a DSC operation that has a specific job ID

This example will display all events generated by the DSC operation that was assigned a particular unique job ID .
PowerShell
Edit|Remove
Trace-xDscOperation -JobId aa6b4f3e-53f9-4f02-a502-26028e7531ca

Example: Get events of the second to last operation run on the localhost machine

This example will display the list of events and their messages published by the DSC operation run second to last, which means, the sequence ID assigned to it is 2.
PowerShell
Edit|Remove
Trace-xDscOperation -SequenceId 2 -ComputerName localhost