16

From time to time I eject a USB device, generally a memory stick or external HDD, when I think I have finished transferring data only to realise there's something else I need to do with it. Normally this involves nothing more than unplugging the device and plugging it back in. What about if I'm doing the work from remote? Is there a command I can run that will have Windows re-detect and mount the device?

Update:

Thanks to all who responded.

Although some of the suggested methods will work they also cause problems if another device is connected via the same hub. Others, such as devcon, may well work for others but failed for me, although I don't know why not and won't be investigating it any further.

I would have preferred not to have to rely on a commercial product but Safelyremove, suggested in the accepted answer, worked so well in my tests I consider it a keeper.

2
  • so you are "soft-ejecting" the USB device remotely? Jul 26, 2009 at 5:30
  • Either by selecting "eject" from Explorer or using "safely remove..." in the system tray. I generally use the latter because the eject option is less than reliable. Jul 26, 2009 at 10:36

6 Answers 6

3
+150

When you "safely remove" a USB HDD - it stops spinning. I believe there's a USB command to turn the device off (sleep mode, actually). So the thing you need is how to turn the device back on.

The application Safelyremove has a command-line tool that is capable of returning the device back: "Returning just stopped device back!".

It is shareware, but it works :)

2
3

When you've click the eject/safely remove, go into device manager (Control panel -> System -> Hardware Tab).

Under USB, you should see the device with a (!) icon. If you view the device, it will say something like:

Windows cannot use this hardware device because its been prepared for "safe removal".

Change the view of Device manager using the View Menu to "Devices by connection". Find the parent USB hub. Right click it and disable the hub, then right click and enable the hub.

3

Command line mountvol or mount. Type in mountvol in command prompt to see your options. It explains all of the options in there. Then create a batch file. You can access the batch file from the remote desktop. Be sure to enable permissions in remote desktop. Try it out.

2
  • I'll give you an upvote for the effort but in reality mountvol is not really viable. Because the target machine and USB port are variables I could have traveled to the remote location and just used the normal GUI method by the time I work out the absurdly cryptic command parameters required. This is an area where Windows could and should have had a simple command but the developers just got plain lazy. Mar 24, 2012 at 6:43
  • 1. To list the currently attached volume names, issue: mountvol 2. To mount a USB to D: drive: `mountvol D: \\?\Volume{4fad0fe5-35f7-11ee-93dc-0010f3895094}` (obtained from step 1)
    – nkanani
    Aug 11, 2023 at 17:41
2

I just tested this out and was able to verify this works in Windows Vista and also verified it works in Windows XP. Disabling and re-enabling the USB device directly did not reinitialize it. The steps below did.

After the device has been "safely removed" go into Device Manager.

Find the USB Mass Storage Device, right-click on it, and select uninstall.

Next, one at at time, disable, and re-enable the USB Host controllers. Take your time with this step, as one of the controllers will reinitialize the USB device.

None of this required a reboot, so it should meet your needs. Ignore any prompts for a reboot.

1

I was also going to suggest devcon, however in addition, there are a few GUI tricks you can use.

If you use eject instead of safely remove, it unmaps the drive and kills all open handles (and displays the popup saying it is safe to remove), however the device is still present. You can then go to Device Manager and disable followed by enable the flash drive, and it should remap itself.

I can not guarantee, but I assume the same should work for safely remove - however if it does actually remove the device, you should be able to readd it by going to Device Manager, right clicking on the computer object and click scan for new hardware.

0

Try Microsoft's devcon command line utility.

1
  • I've tried devcon but it hasn't worked on any of the machines I tested it on. Jul 26, 2009 at 4:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .