Finding serial number of USB drive without WMI

前端 未结 2 1006
抹茶落季
抹茶落季 2021-01-21 13:48

How do we find the serial number of a USB drive without using WMI in c#?

Thanks

2条回答
  •  旧巷少年郎
    2021-01-21 14:37

    The following link looks like a good place to start if you can use WMI. Volatile USB Serial Number Using C#.

    You could implement a WMI soloution as this looks like it is pretty simple code and has been fairly extensivly tested. If you get a WMI error you could gracefully fall into another implementation using non WMI calls.

    To get the serial number without using WMI I would recommend that you look at the microsoft scripting runtime. You can add this to your project references from the COM tab.

提交回复
热议问题