Locate recently connected USB devices on Windows

0.00 avg. rating (0% score) - 0 votes

I had a USB to Ethernet adapter which worked fine on Ubuntu 24 but did not work out of the box by Windows 11 upon connection. A USB connection could be heard when I plugged in the device, but no suitable entries could be located under “Network Adapters” in Device Manager. I then chose View > Devices by connection from Device Manager hoping to locate the device under the corresponding USB hub and realized that the device did in fact appear under “USB Root Hub (USB 3.0)” only to disappear a few seconds later, which pointed out to perhaps some USB enumeration issues.

Screenshot 2024-10-27 234028

To troubleshoot further, I then downloaded USBDeview, run it as administrator, right clicked the column header and chose to show and sort by the Connect Time column. Because USBDeview does not refresh the list as fast as Device Manager I was able to locate the entry for my USB Ethernet adapter connected to Port 0007 of Hub 0002:

Screenshot 2024-10-27 234301

By right clicking the entry and choosing Properties, I was able to establish that the adapter was correctly detected as USB2.0 Ethernet Adapter with instance ID VID_1A86&PID_E397, which can also be obtained by selecting property Hardware Ids from the Details tab of the device under Device Manager, had the USB device shown up normally in Device Manager:

Screenshot 2024-10-27 234635

Because the adapter was identified as a USB 2.0 device, I suspected USB enumeration failed due to incompatibilities with my laptop’s USB 3.0 port and tried again by connecting the adapter to a USB 2.0 hub. Guess what, the adapter now showed up properly in Device Manager and worked fine with no driver installation needed, albeit only at 100Mbps.

Screenshot 2024-10-27 234845

Just to experiment, I also wrote the following simple Powershell script which prints out the name of newly connected USB devices:

# Define the action for USB connection/disconnection
$action = {
    $deviceEvent = $Event.SourceEventArgs.NewEvent
    if ($deviceEvent.EventType -eq 2) {
        Write-Host "USB device connected:" -ForegroundColor Green
        Get-WmiObject Win32_PnPEntity | Where-Object { $_.PNPDeviceID -like "*USB*" } |
            ForEach-Object { Write-Host ("Device Name: " + $_.Name) }
    } elseif ($deviceEvent.EventType -eq 3) {
        Write-Host "USB device disconnected:" -ForegroundColor Red
    }
}

# Register the event to listen for device changes
Register-WmiEvent -Class Win32_DeviceChangeEvent -SourceIdentifier "AllUSBMonitor" -Action $action

Write-Host "Listening for all USB device connections and disconnections. Press Ctrl+C to exit."

# Keep the script running
while ($true) {
    Start-Sleep -Seconds 1
}

To try it out, save the script as usbmon.ps1 and run it in new instance Windows Powershell ISE. The script will then repeatedly print out the names of new USB devices that are connected to the computer. The output is very simple but will help the user to identify the device in question, just in case the device cannot be located with USBDeview or in Device Manager.

0.00 avg. rating (0% score) - 0 votes
ToughDev

ToughDev

A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>