Task Schedular Trigger
I am running MS SyncToy to sync some personal files from my laptop with an external hard drive. I am using Windows 7 and have used the task scheduler to automate it. What I want it to do is to run upon a certain event. When My Passport is plugged into the usb port I want the task to run. Can a trigger be set on the laptop so it knows the hard drive is plugged in? I am not sure where these event is logged so it can trigger the task. Your suggestion is greatly appreciated.
This isn't supported natively, but if you could do it using USBDLM. Have a good read through the online help section on AutoRuns.
It is supported natively, otherwise you wouldn't be able to do this...
Originally Posted by AngryTechnician
PortableApps, SyncToy and Windows Task Scheduler
... or this (using Win32_VolumeChangeEvent)...
Monitoring Volume Change Events in PowerShell using WMI / http://superuser.com/a/93751
You could even bypass Task Scheduler altogether and register WMI events that trigger when a USB HDD/flash drive is inserted. For more info on this, Google 'Register-WmiEvent' (PS 2.0) or 'Register-CimIndicationEvent' (PS 3.0).
I stand corrected. However, the first example (using event log triggers) doesn't allow you to specify an event for a particular USB device (at least not without some serious XPath-fu that isn't in the UI). The example they give will trigger when any USB mass storage device is connected, which is undesirable in most use cases.
The second link looks more promising if the WMI query was expanded to check for a particular device ID, though in my book it's arguable whether something is 'native' to Windows if you have to write your own code... ;)