Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


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.

share|improve this question
so you are "soft-ejecting" the USB device remotely? – Jeff Atwood Jul 26 '09 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. – John Gardeniers Jul 26 '09 at 10:36
up vote 3 down vote accepted

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

share|improve this answer… You saved my USB and my Laptop. – Umair Mar 20 '14 at 14:34
@MariaMeh, hehe, good luck in your development! :) – kolypto Mar 21 '14 at 0:02

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.

share|improve this answer

I just tested this out and was able to verify this works in Vista and also verified it works in 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 the 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.

share|improve this answer

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.

share|improve this answer
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. – John Gardeniers Mar 24 '12 at 6:43

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 re add it by going to device manager, right clicking on the computer object and click scan for new hardware.

share|improve this answer

Have you tried Microsoft's devcon command line utility?

share|improve this answer
I've tried devcon but it hasn't worked on any of the machines I tested it on. – John Gardeniers Jul 26 '09 at 4:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.