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. PhysicalMedia instead of LogicalDisk

PhysicalMedia instead of LogicalDisk

Scheduled Pinned Locked Moved C#
5 Posts 2 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.
  • S Offline
    S Offline
    simplicitylabs
    wrote on last edited by
    #1

    This short bit of code works well for getting the VolumeSerialNumber using win32_logicaldisk:

        ManagementObject disk=new
        ManagementObject("win32\_logicaldisk.deviceid='C:\\'");
        this.textBox2.Text = disk.Properties\["VolumeSerialNumber"\].Value.ToString();
    

    However, I would like to get the manufacturer serial number. I know this is available in win32_PhysicalMedia, but I can't find anything that tells me precisely what the "serial number" is named.

    D 1 Reply Last reply
    0
    • S simplicitylabs

      This short bit of code works well for getting the VolumeSerialNumber using win32_logicaldisk:

          ManagementObject disk=new
          ManagementObject("win32\_logicaldisk.deviceid='C:\\'");
          this.textBox2.Text = disk.Properties\["VolumeSerialNumber"\].Value.ToString();
      

      However, I would like to get the manufacturer serial number. I know this is available in win32_PhysicalMedia, but I can't find anything that tells me precisely what the "serial number" is named.

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

      A little Google goes a long way. All I did was search for "Win32_PhysicalMedia" and wallah[^]!! It's called, oddly enough, SerialNumber. The problem you're going to run into is that there is nothing that says a manufacturer has to fill this field in. This field may come back empty for any given drive or media.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      S 1 Reply Last reply
      0
      • D Dave Kreskowiak

        A little Google goes a long way. All I did was search for "Win32_PhysicalMedia" and wallah[^]!! It's called, oddly enough, SerialNumber. The problem you're going to run into is that there is nothing that says a manufacturer has to fill this field in. This field may come back empty for any given drive or media.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        S Offline
        S Offline
        simplicitylabs
        wrote on last edited by
        #3

        Yup. Did the Google thing. I always do before I bother all you hard working folks. Found the same thing you did, tried it, and my little app crashed -- thought maybe I hadn't found the right name after all. I suppose, based on what you say, it might mean there is no serial for my harddrive. Bummer.

        D 1 Reply Last reply
        0
        • S simplicitylabs

          Yup. Did the Google thing. I always do before I bother all you hard working folks. Found the same thing you did, tried it, and my little app crashed -- thought maybe I hadn't found the right name after all. I suppose, based on what you say, it might mean there is no serial for my harddrive. Bummer.

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

          The last time I did this, only 2 out of 6 of my drives filled in the Serial Number field...

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          S 1 Reply Last reply
          0
          • D Dave Kreskowiak

            The last time I did this, only 2 out of 6 of my drives filled in the Serial Number field...

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            S Offline
            S Offline
            simplicitylabs
            wrote on last edited by
            #5

            That's too bad. It would sure make my life easier if it was a standard all manufacturers followed. Thanks for the feedback.

            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