Jump to content

Information pendrive.


Recommended Posts

Link to comment
Share on other sites

A code posted by @Joelson0007 solved the problem.

#include <String.au3>
#include <Array.au3>
$objWMIService = ObjGet("winmgmts:\\.\root\CIMV2")
$r = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", 0x10 + 0x20)
For $o In $r
    $aRet = _StringExplode($o.PNPDeviceID, "\")
    Switch $aRet[0]
        Case 'USBSTOR'

            $aID = StringRegExp($aRet[1], "VEN_(.*?)&", 3)
            if (IsArray($aID))Then
                MsgBox(4096, 'USB', 'Name = ' & $o.Caption & @CRLF _
                     & 'ID = ' & @CRLF & $o.PNPDeviceID & @CRLF _
                     & 'Manufactured = ' & $aID[0])
                     EndIf
    EndSwitch

Next
Link to comment
Share on other sites

I made some changes to the code, may serve someone well.

#include <String.au3>
#include <Array.au3>

Local $vCryptKey = "2.lt= eocut/ 2cbotbvçhkth9o efewgs:^QA$25t45twhtdn.l"
Local $aArray[1], $informat = "", $aRegExSer = 0
$aArray[0] = "1"

Local $objWMIService = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\.\root\cimv2")
Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", 0x10 + 0x20)
For $objitem In $colItems
    If $objitem.interfacetype = "USB" Then
        $objitem.pnpdeviceid
        $aRegExSer = StringRegExp($objitem.pnpdeviceid, "\x5C([0-9a-fxA-FX]+)&", 3)
        If IsArray($aArray) Then
            $aRet = _StringExplode($objitem.PNPDeviceID, "\")
            $aID = StringRegExp($aRet[1], "VEN_(.*?)&", 3)
            _ArrayAdd($aArray, $aRegExSer[0])
            $informat = "Number= " & $aRegExSer[0] & @CRLF & "Name = " & $objitem.Caption & @CRLF & _
                    "ID = " & $objitem.PNPDeviceID & @CRLF & "Made for = " & $aID[0]
            MsgBox(4096, "", $informat)
        EndIf
    EndIf
Next
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...