- Get Drive Serial Number Vb Net
- Serial Number Idm Gratis
- Drive Serial Number Look Up
- Vb Net Get Set
- How To Find Hard Drive Serial Number
How can I read the hard disk serial number for IDE and SATA drives in VB.NET?(I don't want the volume serial number).
I actually tried with WMI just now and for my flash USB disk there was no serial number, apperently some USB flash drives do have them, some don't. Give this a shot: //import the System.Management namespace at the top in your 'using' statement.
This info should be gathered both for XP and Vista if possible without administrative rights.
dsolimano3 Answers
You can use WMI (Windows Management Instrumentation) like this:
Although, I've read about cases in which no serial number is returned using WMI. Another way to accomplish this would be through Platform Invocation Services (PInvoke).
This article includes a download in which the author implements CreateFile() and DeviceIoControl() to extract drive information through Interop services in VB .NET.
To use either of the above outlined methods you will need ADMIN rights, a utility which seems to circumvent this can be found here. If your feeling adventurous the C++/Win32 source code is available for you to peruse. (Check out the function 'ReadPhysicalDriveInNTWithZeroRights()')
Here is the code to get HDD Serial Number
Hope it Helps.
Not the answer you're looking for? Browse other questions tagged vb.netserial-number or ask your own question.
Is there a way to read USB device serial number and data in a text file in USB using visual studio 2005?
3 Answers
Try this:
Get Drive Serial Number Vb Net
Here's the internals for the USBSerialNumber class:
Source: http://www.cfdan.com/posts/Retrieving_Non-Volatile_USB_Serial_Number_Using_C_Sharp.cfm
The MattThe MattSerial Number Idm Gratis
Or, you can do it with much less code, here's the sample:
Drive Serial Number Look Up
Vb Net Get Set
Matt answer is almost right, but you must pass drive letter without back slash in function:string serial = usb.getSerialNumberFromDriveLetter('f:');