Hi, this might be possible with a task. The basics:
1. Get info from Device Manager about when device is plugged up.
2. From there view the info in Event Viewer.
3. From there create a Task with that info.
Open Device Manager and right click on the Device and choose Properties. Click on the Events tab and at the bottom click on View All Events. In Event Viewer, find the event where the device was connected and select that event from the list. On the right near the bottom, click on Attach Task To This Event. This will bring up a Task creation wizard. Be sure to give the Task a meaningful name. Follow the steps all the way through.
The Task will now be listed in Task Scheduler and you can modify or delete it from there. For me the event was created under a special folder called "Event Viewer Tasks".
I tried the above and was having problems getting it to work. I wanted Notepad to load when a flash drive was plugged in. It wasn't working, but Notepad would randomly pop up. I knew the event was being triggered, but just not at the right time. So I downloaded [
Full Event View] to see what events were being generated when the flash drive was plugged in. I went into Task Scheduler and edited the Trigger to match the Log, Source, and Event ID being shown in the Full Event Viewer and then it worked correctly.
Reference: https://windowsforum.com/threads/windows-task-scheduler-event-on-plug-in-headphone.209697/