Get serial number of USB Drive (correctly)

  • Thread starter Thread starter wingers
  • Start date Start date
W

wingers

Guest
Hi

Need to be able to retrieve serial number of USB hard drives and flash drives

Tried various different methods as a test (not all VB related I know, but good for testing)

Problem is that a lot of them seem to show wrong values


For example if I look in properties of drive in Device Manager I can see serial number of drive is:-

0700079716000026

But if I use WMI (just quickly from command line using "wmic diskdrive get serialnumber" for now OR using say WMI Explorer) it shows it as:-

0700079716000020 e.g. last digit different?

Powershell command of "get-disk | select serialnumber"

Also shows it as 0700079716000020


Getting it from USB controller using something like below:-

gwmi Win32_USBControllerDevice |%{[wmi]($_.Dependent)} | Where-Object {($_.Description -like '*m
ass*')} | Sort Description,DeviceID | ft Description,DeviceID –auto

Seems to get correct? value of 0700079716000026


Please can someone through some light on why different methods change last digit and perhaps offer some ideas on accurate way to get serial number from VB.NET app

Many thanks



Darren Rose

Continue reading...
 

Similar threads

Back
Top