locked
How to eject USB Attached SCSI (UAS) Compatible Device? RRS feed

  • Question

  • I cannot find an example of PowerShell being used to eject a USB attached SCSI (UAS) compatible device(device type 3).  There must be a way to do this because the device can be ejected using "Safely remove hardware and eject media" tool.  I can eject regular USB thumb drives (device type 2) with PowerShell with out issue.

    Edit: Upon further review...

    USB 3.0 supports the USB Attached SCSI protocol (UASP) which uses the SCSI command set.  To "eject" the drive some type of SCSI hot plug operation is probably required.  My PowerShell Fu is too weak to dive deep enough to figure this out.


    • Edited by complicatedstuff Saturday, April 27, 2019 3:25 AM
    • Moved by Bill_Stewart Wednesday, September 4, 2019 9:35 PM This is not "research things for me" forum
    Friday, April 26, 2019 6:32 PM

All replies

  • What have you tried.  Their are hundreds of articles showing how to eject a USB drive with PowerShell.


    \_(ツ)_/

    Friday, April 26, 2019 6:47 PM
  • The most common of the hundreds you mention is:

     $driveEject = New-Object -comObject Shell.Application
     $driveEject.Namespace(17).ParseName("X:").InvokeVerb("Eject")

    This works fine for device type 2, USB thumb drives and the like.  It does not work for device type 3.

    All others I've found somehow remove the drive letter then dismount the drive. The drive indeed silently disappears. Once reinserted the Disk Management tool must be used to assign a drive letter before its usable.


    Friday, April 26, 2019 8:20 PM