Task Sheduler gives me back "Event log request is invalid" (translated from german) for my trigger

MrPapo5 1 Reputation point
2021-11-14T14:14:41.843+00:00

Hello Everyone,

I would like to use the Tasl Sheduler to define a trigger based on the values ​​of an event. The event would be as follows:

  • <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  • <System>
    <Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" />
    <EventID>105</EventID>
    <Version>1</Version>
    <Level>4</Level>
    <Task>100</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8000000000000404</Keywords>
    <TimeCreated SystemTime="2021-11-13T21:32:03.3331558Z" />
    <EventRecordID>6898</EventRecordID>
    <Correlation />
    <Execution ProcessID="4" ThreadID="21748" />
    <Channel>System</Channel>
    <Computer>DESKTOP-KH7DAU3</Computer>
    <Security UserID="S-1-5-18" />
    </System>
  • <EventData>
    <Data Name="AcOnline">true</Data>
    <Data Name="RemainingCapacity">48980</Data>
    <Data Name="FullChargeCapacity">60180</Data>
    </EventData>
    </Event>

As soon as the value "AcOnline" = "true" under "EventData", as well as if the number "Remaining Capacity" is less than 0.8 of the number "FullChargeCapacity", the trigger should be activated.

So I wrote out the event filter for the trigger as follows:

<QueryList>
<Query Id="0" Path="System">
<Select Path="System">[System[(Level=4 or Level=0) and (EventID=105)]] </Select>
<Select Path="System">
[EventData[(Data[@DeezNutz = 'AcOnline']='true') and (Data[@DeezNutz = 'RemainingCapacity'] <= 0.8 * Data[@DeezNutz = 'FullChargeCapacity'])]
</Select>
</Query>
</QueryList>

If I want to confirm this, I get the error message "The specified event log request is invalid" (translated from german) and come back to the previous window ...

As soon as I replace the "<=" with "=" in the line "... (Data [@DeezNutz = 'RemainingCapacity'] <= 0.8 * Data [@DeezNutz = 'FullChargeCapacity']) ...", I can however continue. Unfortunately, that's not what I want to achieve...
The point of all of this is to start a task as soon as my notebook gets power and the battery has less than 80 percent battery capacity.

I hope someone can help me here, thank you for that!

Sincerely

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
12,064 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.