Jump to content

Eject USB Hard Drive After Snapshot Transfer


Recommended Posts

Does anyone know a good way to automaticly eject a USB hard drive after the transfer to it is complete?

 

I used to use a small commandline tool and batch script that Retrospect would run after every job. That worked fine on my old Windows XP backup box, but doesn't seem to function with my new Windows 7 setup – it never releases the drive.

 

Anybody have a solution to this in their own setup?

  • Like 1
Link to comment
Share on other sites

You could try devcon.exe. I use it to detach a removable SATA drive that has ST3500 in its name:

devcon find ST3500*
devcon disable ST3500*
devcon remove ST3500*

You may have to run as administrator, and I find I have to close Retrospect first to release its file handles or the removal says I need to restart.
 

There is also RemoveDrive mentioned in this thread which i have used for USB drives, although it too can get stuck when a program hasn't released the drive or file/folder.

Edited by rsleegers
Link to comment
Share on other sites

Thanks for the suggestion, rsleegers!

 

I think I'm on the right track, but changes in the security model (and the addition of UAC) in Windows 7 is causing me headaches.

 

I've managed to dig up my old retroeventhandler.vbs script. I'm not sure why the example scripts don't appear to be included in Retrospect 10, but they are still called.

 

The long story short is that I have a line that calls:

WshShell.Run """C:\Program Files\RemoveDrive\RemoveDrive"" e:"

 

The request executes, but RemoveDrive fails to eject the drive. So far my testing has shown that I can reproduce this error when I launch the script as a normal user, but an elevated user executes as it should. This is particularly confusing as Retrospect runs as an elevated user, so I'd expect it to launch its scripts as such.

 

 

In any event, I've given up doing it the fancy way for the moment and just placed the call to RemoveDrive as a scheduled task. My backups are predictable enough that should work for now.

Link to comment
Share on other sites

If you enable the 'Quick Removal' option for the USB drive (not having a USB drive to hand can't say exactly where the setting is) you should be able to unplug the drive without first having to eject it. By default this option is disabled to improve write performance hence the usual need to eject the drive to clear the write cache.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...