HOWTO: Windows Task Scheduler Run automatically when device is plugged in #734
brandonhiga
started this conversation in
General
Replies: 3 comments
-
Thanks for sharing this procedure! I will add a link in the wiki page |
Beta Was this translation helpful? Give feedback.
0 replies
-
Windows 11 Pro 24H2 use this |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So I got Windows 10 Task Scheduler set up to automatically run the application when the device is plugged in. I believe it should work the same in Windows 11 but I haven't tested that yet.
Enable Plug and Play Tracking
auditpol /set /subcategory:"Plug and Play Events" /success:enabled
to enable success tracking for Plug and Play events. This will get an event 6416 in the Security log when a USB device is connectedauditpol /get /subcategory:"Plug and Play Events"
to verify the setting was applied - it should have Success in the setting, rather than the default of No AuditingRecord the device ID
Create the Task
<QueryList> <Query Id="0" Path="Security"> <Select Path="Security">*[System[(Level=4 or Level=0) and (EventID=6416)]] and *[EventData[Data[@Name='DeviceId'] and (Data='USB\VID_1A86&PID_5722\USB35INCHIPSV2')]]</Select> </Query> </QueryList>
USB\VID_1A86&PID_5722\USB35INCHIPSV2
with your device's ID that you recorded and escape the ampersand (&) by replacing it with&
- if you don't escape the ampersand it will tell you the query is invalid.Test it out
You should be good now - plug the screen back in and it should reinitialize.
Notes
EDIT: 2025/04/06 - Change If task is already running option to Do not start a new instance because on genuine Turing 3.5-inch it disappears from the bus and reconnects after the app initialize, causing a loop.
Beta Was this translation helpful? Give feedback.
All reactions