Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Using .NET's WMI to Identify Pen-Drive's Unique ID

Using .NET's WMI to Identify Pen-Drive's Unique ID

Scheduled Pinned Locked Moved C#
csharpquestion
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marcos Accioly
    wrote on last edited by
    #1

    Hello, I have been trying to modify the available .NET WMI examples on The Code Project so that I could uniquely identify a pen-drive (usb key). Unlike the hard disks, pen drives do not expose a property like UniqueID. Any ideas of what I could use to uniquely identify it? I have already read and tried the "normal" examples available on .NET's WMI. Thank you all in advance, Vini - CSharping a lot

    M 1 Reply Last reply
    0
    • M Marcos Accioly

      Hello, I have been trying to modify the available .NET WMI examples on The Code Project so that I could uniquely identify a pen-drive (usb key). Unlike the hard disks, pen drives do not expose a property like UniqueID. Any ideas of what I could use to uniquely identify it? I have already read and tried the "normal" examples available on .NET's WMI. Thank you all in advance, Vini - CSharping a lot

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      Hi! I think Win32_DiskDrive.PNPDeviceID is unique. I tried it with two idential usb sticks and they gave different PNPDeviceID's.

      Regards, mav -- Black holes are the places where god divided by 0...

      M 1 Reply Last reply
      0
      • M mav northwind

        Hi! I think Win32_DiskDrive.PNPDeviceID is unique. I tried it with two idential usb sticks and they gave different PNPDeviceID's.

        Regards, mav -- Black holes are the places where god divided by 0...

        M Offline
        M Offline
        Marcos Accioly
        wrote on last edited by
        #3

        mav.northwind wrote:

        Hi! I think Win32_DiskDrive.PNPDeviceID is unique. I tried it with two idential usb sticks and they gave different PNPDeviceID's.

        Hi Mav... Tried that but unfortunately I think I couldn't use that, as windows gives your pen-drive a different PNPDeviceID each time you plug it in. =) I needed something that could tell "Oh, this is Jimmy's pen-drive" for instance. I am developing an app in which, along with user and password, the client system has to provide an unique ID for the pen-drive being used with the app. Any other ideas? Regards... Vini

        D M 2 Replies Last reply
        0
        • M Marcos Accioly

          mav.northwind wrote:

          Hi! I think Win32_DiskDrive.PNPDeviceID is unique. I tried it with two idential usb sticks and they gave different PNPDeviceID's.

          Hi Mav... Tried that but unfortunately I think I couldn't use that, as windows gives your pen-drive a different PNPDeviceID each time you plug it in. =) I needed something that could tell "Oh, this is Jimmy's pen-drive" for instance. I am developing an app in which, along with user and password, the client system has to provide an unique ID for the pen-drive being used with the app. Any other ideas? Regards... Vini

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          You might be able to gleen something useful from this[^].

          Dave Kreskowiak Microsoft MVP - Visual Basic

          1 Reply Last reply
          0
          • M Marcos Accioly

            mav.northwind wrote:

            Hi! I think Win32_DiskDrive.PNPDeviceID is unique. I tried it with two idential usb sticks and they gave different PNPDeviceID's.

            Hi Mav... Tried that but unfortunately I think I couldn't use that, as windows gives your pen-drive a different PNPDeviceID each time you plug it in. =) I needed something that could tell "Oh, this is Jimmy's pen-drive" for instance. I am developing an app in which, along with user and password, the client system has to provide an unique ID for the pen-drive being used with the app. Any other ideas? Regards... Vini

            M Offline
            M Offline
            mav northwind
            wrote on last edited by
            #5

            ReHi! At least with the 4 sticks (3 different brands) I tried it with, they all kept their PNPDeviceID, even when I plugged them into another computer. But your mileage may vary...

            Regards, mav -- Black holes are the places where god divided by 0...

            M 1 Reply Last reply
            0
            • M mav northwind

              ReHi! At least with the 4 sticks (3 different brands) I tried it with, they all kept their PNPDeviceID, even when I plugged them into another computer. But your mileage may vary...

              Regards, mav -- Black holes are the places where god divided by 0...

              M Offline
              M Offline
              Marcos Accioly
              wrote on last edited by
              #6

              mav.northwind wrote:

              At least with the 4 sticks (3 different brands) I tried it with, they all kept their PNPDeviceID, even when I plugged them into another computer. But your mileage may vary...

              You're quite right, mav... Looking through msinfo32.exe I could check that it remains the same, actually. I also tested on another workstation. Thanks a lot for your help. And btw: the link that Dave (if Im not wrong) posted is very nice. If you wanna take a peek: http://msdn.microsoft.com/coding4fun/someassemblyrequired/isthatyou/default.aspx Cheers,

              M 1 Reply Last reply
              0
              • M Marcos Accioly

                mav.northwind wrote:

                At least with the 4 sticks (3 different brands) I tried it with, they all kept their PNPDeviceID, even when I plugged them into another computer. But your mileage may vary...

                You're quite right, mav... Looking through msinfo32.exe I could check that it remains the same, actually. I also tested on another workstation. Thanks a lot for your help. And btw: the link that Dave (if Im not wrong) posted is very nice. If you wanna take a peek: http://msdn.microsoft.com/coding4fun/someassemblyrequired/isthatyou/default.aspx Cheers,

                M Offline
                M Offline
                mav northwind
                wrote on last edited by
                #7

                Marcos Accioly wrote:

                And btw: the link that Dave (if Im not wrong) posted is very nice. If you wanna take a peek: http://msdn.microsoft.com/coding4fun/someassemblyrequired/isthatyou/default.aspx

                Yup, I already browsed through it. Very nice, indeed. :)

                Regards, mav -- Black holes are the places where god divided by 0...

                M 1 Reply Last reply
                0
                • M mav northwind

                  Marcos Accioly wrote:

                  And btw: the link that Dave (if Im not wrong) posted is very nice. If you wanna take a peek: http://msdn.microsoft.com/coding4fun/someassemblyrequired/isthatyou/default.aspx

                  Yup, I already browsed through it. Very nice, indeed. :)

                  Regards, mav -- Black holes are the places where god divided by 0...

                  M Offline
                  M Offline
                  Marcos Accioly
                  wrote on last edited by
                  #8

                  Hi again mav, I actually tried the PNPDeviceID for my LG UP3D USB Device and it simply informed nothing. *But* going to msinfo32.exe gives me the following output: LG UP3D USB Device USBSTOR\DISK&VEN_LG_UP3D&PROD_&REV_\200508010001&0 USB Mass Storage Device USB\VID_043E&PID_7090\200508010001 which tells me that windows actually has a PNPDeviceId for it, that being VID_043E&PID_7090 (according to the article at Coding4Fun about the wireless usb PC Lock). Now the question is: Why? you can check out a printscreen I've done of the simple app for identifying the hardware HERE Cheers, Vini

                  M 1 Reply Last reply
                  0
                  • M Marcos Accioly

                    Hi again mav, I actually tried the PNPDeviceID for my LG UP3D USB Device and it simply informed nothing. *But* going to msinfo32.exe gives me the following output: LG UP3D USB Device USBSTOR\DISK&VEN_LG_UP3D&PROD_&REV_\200508010001&0 USB Mass Storage Device USB\VID_043E&PID_7090\200508010001 which tells me that windows actually has a PNPDeviceId for it, that being VID_043E&PID_7090 (according to the article at Coding4Fun about the wireless usb PC Lock). Now the question is: Why? you can check out a printscreen I've done of the simple app for identifying the hardware HERE Cheers, Vini

                    M Offline
                    M Offline
                    mav northwind
                    wrote on last edited by
                    #9

                    The wonders of windows... I'm afraid I don't have the faintest idea why :(

                    Regards, mav -- Black holes are the places where god divided by 0...

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups