How to get serial number of USB-Stick in C#

前端 未结 3 1969
梦如初夏
梦如初夏 2020-12-04 12:57

How do I get the internal serial number of a USB-Stick or USB-HardDrive in C#?

3条回答
  •  甜味超标
    2020-12-04 13:35

    I had problems with the solution offered by Yuval Adam as every USB stick I tried return blank on windows 7.

    I solved this by just looking at the property PNPDeviceId on the current object.

    E.g.

    currentObject["PNPDeviceID"].ToString();
    

    Not sure how valid this is but it worked for me on the 3 USB Sticks I tried

提交回复
热议问题