Quantcast
Viewing latest article 6
Browse Latest Browse All 15

New Post: EventLog Consumer : InsertionStringTemplates argument writes %1% to eventlog

Hi,

I use the following code

Import-Module PowerEvents$MyFilter= New-WMIEventFilter -Name NICDisabledTrigger -Query "Select * from __InstanceModificationEvent within 2 Where TargetInstance ISA 'Win32_NetworkAdapter' AND TargetInstance.ConfigManagerErrorCode = 22"$MyConsumer= New-WMIEventConsumer -Name NICDisabledActionner -ConsumerType EventLog -EventType Information -EventID 20 -SourceName MyAppLogSource -InsertionStringTemplates "Adapter %TargetInstance.Name% entered the state disabled"


New-WMIFilterToConsumerBinding -Filter $MyFilter-Consumer $MyCons

It checks if a network adapter has been disabled. The problem is that in the eventlog source MyAppLogSource (that already exists of course), the evnt is well created, but the description is %1%, instead of 'Adapter %TargetInstance.Name%....'

Do you know why ?

 

Thx a lot and good job btw


Viewing latest article 6
Browse Latest Browse All 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>