Menu

#10 Lock on USB key serial number

Development_Team
open
nobody
5
2013-01-15
2010-09-15
mad max
No

In USB spécification USB device must have an unique serial. Lock on this serial can be great to use USB key like USB Token.
I have C# sample code to extract it :

ManagementObjectSearcher disks = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
foreach (ManagementObject disk in disks.Get())
{

if (disk["Name"].ToString() == ("\\\\.\\PHYSICALDRIVE" + driveNumber) & disk["InterfaceType"].ToString() == "USB")
{
SerialNumber = disk["PNPDeviceID"] ;
}
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.