Jump to content

Recommended Posts

Posted
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.
Posted
This isn't supported natively

It is supported natively, otherwise you wouldn't be able to do this...

 

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).

Posted (edited)

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... ;)

Edited by AngryTechnician

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...