Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to have the Windows Task Scheduler to run a program when I plug in my external hard disk drive. I know how to set the time and boot schedules but for event schedules I have no idea.

Is it too much trouble to run applications by events? I can just use a shortcut instead or make the event happen every 30 mins or so to run the job. (Usually I have it attached for 30 mins + enough time for the job to finish.)

share|improve this question
You could create a scheduled task to run every 30 min that uses a VBscript to check for your plugged in disk. I'm not putting this as an answer since I don't have time to write the script :)(leaving work!) – Jeff F. Sep 15 '10 at 21:45
The app checks the path before doing anything so i dont need that. I decided every 30mins is 'soon enough' – acidzombie24 Sep 16 '10 at 15:22
up vote 2 down vote accepted

I am doing this also,

Here an XML export of my task. You can import it and customize it for your use case:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="">
    <Description>TODO: run rsyn on this trigger to backup directories!!</Description>
      <Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="Microsoft-Windows-DriverFrameworks-UserMode/Operational"&gt;&lt;Select Path="Microsoft-Windows-DriverFrameworks-UserMode/Operational"&gt;*[System[Provider[@Name='Microsoft-Windows-DriverFrameworks-UserMode'] and EventID=2101]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
    <Principal id="Author">
  <Actions Context="Author">
      <Title>Yes 2</Title>
      <Body>USB disk ok</Body>

This file shows a popup message when a USB key is inserted.

You may have to customize it.


share|improve this answer

Check a previous answer I have given on this site to add an event handler using a script with Powershell (built-in Windows 7) that is started at logon using Task Scheduler.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.