View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default write usb flash drive information in to excel cell

Look into working with WMI using the "\root\CIMV2" namespace. The info
you want is available but requires running queries in several WMI
classes so that you're sure you're polling the correct USB device...

Win32_LogicalDisk
Query this class filtering only USB drives via
DriveType = "1" (RemoveableDisk).
Make sure you check its ID matches its drive letter (Path).
Note that the device.ID is its system descriptor (drive assigned
when it got plugged in)

Win32_DiskDrive
Query this class for its ".PNPDeviceID" and its ".Size".
The PnpDeviceID for my Kingston DataTraveler stick returns as...

"USBSTOR\DISK&VEN_KINGSTON&PROD_DATATRAVELER_2.0&R EV_PMAP\5B8805000088&0"
The Size for this drive returns as "8003197440"

...which gives you lots of info to work with from just 2 values.

HTH

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion