EvotecIT/PSEventViewer

Error The description string for parameter reference (%1) could not be found

Closed this issue · 0 comments

Get-Events -LogName 'System'  -Verbose  
                                                                                                                                                                                                                                                                                                                                                       
VERBOSE: Get-Events - Preparing data to scan computer EVOWIN
VERBOSE: Get-Events - Filter parameters provided LogName = System
VERBOSE: Get-Events - Running query with parallel enabled...
VERBOSE: Get-Events -------------START---------------------
VERBOSE: Get-Events - Inside EVOWIN for Events ID: 
VERBOSE: Get-Events - Inside EVOWIN for Events LogName: System
VERBOSE: Get-Events - Inside EVOWIN for Events RecordID:
VERBOSE: Get-Events - Inside EVOWIN for Events Oldest: False
VERBOSE: Get-Events - Inside EVOWIN Data in FilterHashTable LogName System
VERBOSE: Constructed structured query:
<QueryList><Query Id="0" Path="system"><Select Path="system">*</Select></Query></QueryList>.
VERBOSE: Get-Events - Inside EVOWIN Error The description string for parameter reference (%1) could not be found
VERBOSE: Get-Events - Inside EVOWIN Time to generate 0 hours, 0 minutes, 27 seconds, 171 milliseconds
VERBOSE: Get-Events --------------END----------------------
VERBOSE: Get-Events - Overall errors: 1
VERBOSE: Get-Events - Overall events processed in total for the report: 0
VERBOSE: Get-Events - Overall time to generate 0 hours, 0 minutes, 27 seconds, 279 milliseconds
VERBOSE: Get-Events - Overall events processing end

Possible solution:
https://stackoverflow.com/questions/50822808/the-description-string-for-parameter-reference-1-could-not-be-found

The workaround I ended up implementing is as follows:

private string FormatEventDescription(EventRecord eventRecord)
{
    try
    {
        return eventRecord.FormatDescription();
    }
    catch (EventLogException e)
    {
        return eventRecord.ToXml();
    }
}

This is less than satisfactory, as that XML is not user-friendly, but at least it has all the information needed in case we need to know the original content of the EventRecord. Note the XML doesn't necessarily contain the description string inside, sometimes these events have a list of parameters which are used to fill a message template to generate the description string, so in this case you'll get the raw params.