The Core Technologies Blog

Professional Software for Windows Services / 24×7 Operation

How to Start your Windows Service When a USB Flash Drive is Inserted

Windows Services are designed to start up at boot and run 24×7, but that framework is overkill for server software that must occasionally come alive to process specific events and go back to a waiting state. Service Triggers were introduced in Windows 7 to remedy the situation but at this point, only a handful of triggering events are supported. We look forward to more capabilities (and better documentation!) of this useful feature in future versions of Windows.

If you have a Windows Service that works with USB flash drives, you can use our free Service Trigger Editor utility to configure your service to start when a flash drive is inserted. To do so:

  1. Download Service Trigger Editor from our web site. Note that it is a standalone executable, ServiceTriggerEditor.exe, so just save it in a new folder on your hard drive.

  2. Run ServiceTriggerEditor.exe. You should see the standard security prompt if User Account Control (UAC) is enabled on your PC:

    Service Trigger Editor: UAC Prompt

    Service Trigger Editor is digitally signed by our company for your safety & security so please click Yes to proceed.

  3. Once the utility’s main window comes up, listing all services installed on your PC, find and highlight the service you wish to modify. We have selected the SyncToy service (created by our AlwaysUp product) for this tutorial.

    Service Trigger Editor: Main Window

  4. Select Trigger > Add… to summon the Add Trigger window. Adjust the settings to start the service when A specific device arrives (or is present at startup).

    Add a Device Arrival Trigger

  5. Next, click the Add… button on the right, enter USBSTOR\GenDisk in the window that comes up, and click OK to record that value.

    Add Trigger Data

    We’re now done configuring this new trigger so click the Save >> button.

    Add a Device Arrival Trigger

That’s it. Next time you insert a USB flash drive, your service will start. Enjoy!

Posted in Service Trigger Editor | Tagged , , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *