hello..
somebody can helpme about get the serial number of pen drive ( not volume information).
thanks all...
Printable View
hello..
somebody can helpme about get the serial number of pen drive ( not volume information).
thanks all...
here is some code to get serial number, if you have more than 1 usb drive you will need to make an array or simething, as obviously this will only get the serial number of the last usb drive
vb Code:
strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colitems = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", , 48) For Each objitem In colitems If objitem.interfacetype = "USB" Then sernum = objitem.pnpdeviceid Next sernum = Mid(sernum, InStrRev(sernum, "\") + 1) sernum = Left(sernum, InStr(sernum, "&") - 1)
can you post some complete example?
its because i dont know how to use that sample...
thanks..
that is complete, put command button, with the above code for click event, the serial number is in the variable sernum
thanks that works :)
You are just too good Man. I looked high and dry on the net for this code but none came even close enough. If u cud make it detect all usb drives and their serial numbers in a list,you've got a winner.Quote:
READ USB serial number with VB.
Anyway, i bow to the master.
the code does return all usb drives, just as it stands it only retains the last one, just add each to a listbox or an array to work with
westconn1, your code is fantastic! Thank you.
The code is nice and it works. But new Pen Drive does not have Serial No. Old Transcend have serial No. But now dont have it. Is there any chance to make a serial No by our own for the pen drive or is there any pen drive with Serial No in Market.
Thanks in advance
Thiyagu
ask before you buy, as they are now so cheap, maybe the manufacturer don't bother with serial number any more, i think all mine have, but i have not bought any new for a while