I have been searching for a solution to this for weeks. I'm looking for a way I can uniquely identify any storage media connected to a Windows PC. Storage media in particular. This can include internal hard drives, external hard drives, flash drives, SD cards, smartphone storage, etc. No optical media.
Basically what I want to do, is designate some kind of unique string that is tied to a specific storage device, so any time that storage device is reconnected, regardless of drive letter, it can be auto-detected.
Problems I have run into:
ManagementObjectSearcher
class is related to the card reader rather than the mediaIt seems there are 4 main properties that CAN return unique information, but don't always. SerialNumber
, Caption
, PNPDeviceID
, Signature
Surely there must be SOMETHING that Windows does to keep track of storage devices like this. Any ideas?
Can you write to these media? If so, how about creating a file in the root directory containing a GUID and storing a reference to that GUID in your app. As GUIDs and guaranteed unique, you can use this file to uniquely identify the volume.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With