有没有人有任何建议,最好是可以在Windows 7和xp上运行的东西,我已经尝试了这里发布的类http://www.cfdan.com/posts/Retrieving_Non-Volatile_USB_Serial_Number_Using_C_Sharp.cfm但是永远不会返回序列号。
据我所知,usb上的序列号是可选的,但我尝试了3个单独的usb棒,所以我怀疑这是问题。
答案 0 :(得分:0)
来自this post:
ManagementObjectSearcher theSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive WHERE InterfaceType='USB'");
foreach (ManagementObject currentObject in theSearcher.Get())
{
ManagementObject theSerialNumberObjectQuery = new ManagementObject("Win32_PhysicalMedia.Tag='" + currentObject["DeviceID"] + "'");
MessageBox.Show(theSerialNumberObjectQuery["SerialNumber"].ToString());
}