Jump to content

List USB connected devices


ivan
 Share

Recommended Posts

Does any one know how I can list the currently connected devices to USB ports? I.e, Flash memory sticks, printers, mobile phone (cables), cameras, etc

Thanks in advance

IVAN

How 'bout (trimmed down from Scriptomatic)

$strComputer = "."
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity where DeviceID like 'USB\\%'")

If IsObj($colItems) then
    For $objItem In $colItems
        LogIt("--------------------------------------")
        LogIt("Caption: " & $objItem.Caption)
        LogIt("DeviceId: " & $objItem.DeviceID)
    Next
Endif
; ----------------------------------------------------

Func LogIt($sText)
    ConsoleWrite($sText & @LF)
EndFunc

The 'LogIt' function is for use with Scite it just displays info the display pane.

If you need more info, Google Win32_PnpEntity and/or the AutoIt Scriptomatic.

AutoIt Scriptomatic

Bill

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...