< Back

Get-CDscWinEvent

Sun Jan 12, 2020 9:39 pm

NAME Get-CDscWinEvent



SYNOPSIS

Gets events from the DSC Windows event log.





SYNTAX

Get-CDscWinEvent [-ComputerName <String[]>] [-ID <Int32>] [-Level <Int32>] [-StartTime <DateTime>] [-EndTime

<DateTime>] [<CommonParameters>]



Get-CDscWinEvent [-ComputerName <String[]>] [-ID <Int32>] [-Level <Int32>] [-StartTime <DateTime>] [-EndTime

<DateTime>] -Wait [-WaitTimeoutSeconds <UInt32>] [<CommonParameters>]





DESCRIPTION

Thie `Get-CDscWinEvent` function gets log entries from the `Microsoft-Windows-DSC/Operational` event log, where

the Local Configuration Manager writes events. By default, entries on the local computer are returned. You can

return entries from another computer via the `ComputerName` parameter.



You can filter the results further with the `ID`, `Level`, `StartTime` and `EndTime` parameters. `ID` will get

events with the specific ID. `Level` will get events at the specified level. `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-CFirewallRule -Name '*Remove Event Log Management*' |

ForEach-Object { netsh advfirewall firewall set rule name= $_.Name new enable=yes }



`Get-CDscWinEvent` is new in Carbon 2.0.





PARAMETERS

-ComputerName <String[]>

The computer whose DSC errors to return.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ID <Int32>

The event ID. Only events with this ID will be returned.



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Level <Int32>

The level. Only events at this level will be returned.



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-StartTime <DateTime>

Get errors that occurred after this date/time.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-EndTime <DateTime>

Get errors that occurred before this date/time.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Wait [<SwitchParameter>]

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

log.



Required? true

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? 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.



Required? false

Position? named

Default value 10

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.Diagnostics.Eventing.Reader.EventLogRecord





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-CDscWinEvent



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









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-CDscWinEvent -ComputerName 10.1.2.3



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









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-CDscWinEvent -StartTime '8/1/2014 0:00'



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









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-CDscWinEvent -EndTime '8/30/2014 11:59:59'



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









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Get-CDscWinEvent -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.









-------------------------- EXAMPLE 6 --------------------------



PS C:\\>Get-CDscWinEvent -Level ([Diagnostics.Eventing.Reader.StandardEventLevel]::Error)



Demonstrates how to get events at a specific level, in this case, only error level entries will be returned.









-------------------------- EXAMPLE 7 --------------------------



PS C:\\>Get-CDscWinEvent -ID 4103



Demonstrates how to get events with a specific ID, in this case `4103`.











RELATED LINKS

Write-CDscError

Get-CDscWinEvent