Hi Trevor,
I have a problem with "EventLog" consumers: I am not able to write the InsertionStringTemplatesin the event log. Whenever I generate the event, the associated consumer is triggered and it writes a row in the event log, but the description is always: "The description for Event ID ( 9898 ) in Source ( WCT Agent ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description".
The operating system is Windows 2003 Server R2 SP2, running in a VMware Virtual Machine.
The code is reported below:
$objEventFilter = New-WmiEventFilter –Name ExternalStorageAdded –Query "select * from __InstanceCreationEvent within 5 where TargetInstance isa 'win32_logicaldisk'"
$objEventConsumer = New-WmiEventConsumer –ConsumerType EventLog -EventId 9898 –Name ExternalStorageAdded –EventType Information -InsertionStringTemplates "External storage connected" -SourceName "WCT Agent"
New-WmiFilterToConsumerBinding –Filter $objEventFilter –Consumer $objEventConsumer
Could you give me any suggestions, please?