Get-DscError

Gets DSC errors from a computer's event log.

Syntax

Get-DscError [-ComputerName <String[]>] [-StartTime <DateTime>] [-EndTime <DateTime>] [<CommonParameters>]

Get-DscError [-ComputerName <String[]>] [-StartTime <DateTime>] [-EndTime <DateTime>] -Wait [-WaitTimeoutSeconds <UInt32>] [<CommonParameters>]

Description

The DSC Local Configuration Manager (LCM) writes any errors it encounters to the Microsoft-Windows-DSC/Operational event log, in addition to some error messages that report that encountered an error. This function gets just the important error log messages, skipping the superflous ones that won't help you track down where the problem is.

By default, errors on the local computer are returned. You can return errors from another computer via the ComputerName parameter.

You can filter the results further with the StartTime and EndTime parameters. StartTime will return entries after the given time. EndTime will return entries before the given time.

If no items are found, nothing is returned.

It can take several seconds for event log entries to get written to the log, so you might not get results back. If you want to wait for entries to come back, use the -Wait switch. You can control how long to wait (in seconds) via the WaitTimeoutSeconds parameter. The default is 10 seconds.

When getting errors on a remote computer, that computer must have Remote Event Log Management firewall rules enabled. To enable them, run

Get-FirewallRule -Name '*Remove Event Log Management*' |
    ForEach-Object { netsh advfirewall firewall set rule name= $_.Name new enable=yes }

Get-DscError is new in Carbon 2.0.

Related Commands

Parameters

Name Type Description Required? Pipeline Input Default Value
ComputerName String[]

The computer whose DSC errors to return.

false false
StartTime DateTime

Get errors that occurred after this date/time.

false false
EndTime DateTime

Get errors that occurred before this date/time.

false false
Wait SwitchParameter

Wait for entries to appear, as it can sometimes take several seconds for entries to get written to the event log.

true false False
WaitTimeoutSeconds UInt32

The time to wait for entries to appear before giving up. Default is 10 seconds. There is no way to wait an infinite amount of time.

false false 10

Return Values

System.Diagnostics.Eventing.Reader.EventLogRecord.

EXAMPLE 1

Get-DscWinEvent

Demonstrates how to get all the DSC errors from the local computer.

EXAMPLE 2

Get-DscError -ComputerName 10.1.2.3

Demonstrates how to get all the DSC errors from a specific computer.

EXAMPLE 3

Get-DscError -StartTime '8/1/2014 0:00'

Demonstrates how to get errors that occurred after a given time.

EXAMPLE 4

Get-DscError -EndTime '8/30/2014 11:59:59'

Demonstrates how to get errors that occurred before a given time.

EXAMPLE 5

Get-DscError -StartTime '8/1/2014 2:58 PM' -Wait -WaitTimeoutSeconds 5

Demonstrates how to wait for entries that match the specified criteria to appear in the event log. It can take several seconds between the time a log entry is written to when you can read it.