How do I get Windows to re-attach a USB device without having to plug it in again?

1,574

Solution 1

  1. Device Manager
  2. Universal Serial Bus controllers
  3. USB Mass Storage Device find one with yellow (!)
  4. Disable device, [Yes] to disable
  5. Enable device, [No] to restart
  6. Disable device second time :D [Yes] to disable, [No] to restart
  7. Enable device

Device reconnected.

Solution 2

Check the RescanDevices (ZIP file) tool at this Drive Tools for Windows page.

When an IDE or SATA drive has been prepared for safe removal it can be brought back by a scan for new hardware. That's what this tool initiates.

It is a non interactive, invisible Windows application. It does the same as Microsoft's tool DEVCON when called with parameter 'rescan'.

There are some other good notes and tools at that page.

Solution 3

It was answered it on Server Fault a while ago! My answer was -

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.

You can also try a utility called DEVCON.

Share:
1,574

Related videos on Youtube

OM The Eternity
Author by

OM The Eternity

Updated on September 17, 2022

Comments

  • OM The Eternity
    OM The Eternity almost 2 years

    i have a form in which user can upload 100 mb file which results delay in upload, hence I decided to first zip the image on form submit and then upload it on server and then extract it on server. so that loading process decreases, Hence for this I have used a script which is as follows:

    <?php
    $zip = new ZipArchive();
    $filename = "newzip.zip";
    
    if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
       exit("cannot open <$filename>\n");
    }
    $zip->addFromString("myfile.jpeg", 
    "This is the first file in our ZIP, added as 
    firstfile.txt.\n");
    
    echo "numfiles: " . $zip->numFiles . "\n";
    $zip->close();
    
    $zip1 = zip_open("newzip.zip");
    if ($zip1) {
      while ($zip_entry = zip_read($zip1)) {
        $fp = fopen(zip_entry_name($zip_entry), "w");
        if (zip_entry_open($zip1, $zip_entry, "r")) {
          $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
          fwrite($fp,"$buf");
          zip_entry_close($zip_entry);
          fclose($fp);
        }
      }
      zip_close($zip1);
      unlink("newzip.zip");
    }
    ?>
    

    Now here from the above code I get the image extracted, but after extraction the size of image is reduced to 61 bytes and is corrupt i.e. it cannot be viewed.

    What could be wrong with this code please guide me

  • Ben Collier
    Ben Collier almost 15 years
    Gave this a go and it doesn't seem to do anything. I also downloaded the MS DEVCON tool and devcon rescan doesn't re-attach the drive.
  • OM The Eternity
    OM The Eternity almost 14 years
    So what should I do to get the image zipped out of this code?
  • OM The Eternity
    OM The Eternity almost 14 years
    How to use java applet to do that?
  • Artefacto
    Artefacto almost 14 years
    You code already extracts all the files in the zip file... It's just that you're extracting a zip file you just created and that zip file is completely disconnected from something form related. See wimvds answer.
  • Chiffa
    Chiffa over 10 years
    I had a different problem: after a while, my windows 7 failed to see my external usb drive, which was still plugged in. The RescanDevices tool found it in a matter of seconds, but I wonder why did the problem occur in the first place.
  • Laurie Stearn
    Laurie Stearn over 4 years
    In Windows 10, detecting an ejected stick is a bit tricky, as there is no yellow exclamation mark on the USB Mass Storage Device. One thing to go on is the location in Properties>General. Fine as long as it is not the one with the 30 digit address, but not if there is more than one stick connected,
  • gog
    gog almost 4 years
    Great. This also works with disks connected through eSATA ports. Additional note: you may have to ignore warnings about the need to restart the system