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. How to check a field/property is existing in Win32_DiskDrive ?

How to check a field/property is existing in Win32_DiskDrive ?

Scheduled Pinned Locked Moved C#
tutorialdatabasequestion
8 Posts 3 Posters 2 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.
  • T Offline
    T Offline
    taibc
    wrote on last edited by
    #1

    Hi everyone, I am using below codes to get information from HardDisk.

    ManagementObjectSearcher HardwareQuerySearcher = null;

    HardwareQuerySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");

    foreach (ManagementObject hard in HardwareQuerySearcher.Get())
    {
    Hard hdd = new Hard();
    hdd.Model = hard["Model"].ToString();
    hdd.Type = hard["InterfaceType"].ToString();
    hdd.Type = hard["SerialNumber"].ToString();
    }

    Do you know how to list/or show all fields/properties that existing in this query ? For example: I am want to know wherether the field "SerialNumber" existing or not ? Thanks and regards, Tai

    S W 2 Replies Last reply
    0
    • T taibc

      Hi everyone, I am using below codes to get information from HardDisk.

      ManagementObjectSearcher HardwareQuerySearcher = null;

      HardwareQuerySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");

      foreach (ManagementObject hard in HardwareQuerySearcher.Get())
      {
      Hard hdd = new Hard();
      hdd.Model = hard["Model"].ToString();
      hdd.Type = hard["InterfaceType"].ToString();
      hdd.Type = hard["SerialNumber"].ToString();
      }

      Do you know how to list/or show all fields/properties that existing in this query ? For example: I am want to know wherether the field "SerialNumber" existing or not ? Thanks and regards, Tai

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #2

      have a read of this Win32_DiskDrive class[^]

      Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

      T 2 Replies Last reply
      0
      • T taibc

        Hi everyone, I am using below codes to get information from HardDisk.

        ManagementObjectSearcher HardwareQuerySearcher = null;

        HardwareQuerySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");

        foreach (ManagementObject hard in HardwareQuerySearcher.Get())
        {
        Hard hdd = new Hard();
        hdd.Model = hard["Model"].ToString();
        hdd.Type = hard["InterfaceType"].ToString();
        hdd.Type = hard["SerialNumber"].ToString();
        }

        Do you know how to list/or show all fields/properties that existing in this query ? For example: I am want to know wherether the field "SerialNumber" existing or not ? Thanks and regards, Tai

        W Offline
        W Offline
        Wayne Gaylard
        wrote on last edited by
        #3

        MSDN[^] is your friend. :)

        Everyone dies - but not everyone lives

        T 1 Reply Last reply
        0
        • S Simon_Whale

          have a read of this Win32_DiskDrive class[^]

          Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

          T Offline
          T Offline
          taibc
          wrote on last edited by
          #4

          Thank you

          1 Reply Last reply
          0
          • W Wayne Gaylard

            MSDN[^] is your friend. :)

            Everyone dies - but not everyone lives

            T Offline
            T Offline
            taibc
            wrote on last edited by
            #5

            Thank you. Do you know what is difference between the property: SerialNumber of "Win32_PhysicalMedia" and SerialNumber of "Win32_DiskDrive" ? When I use Win32_DiskDrive, I can't get SerialNumber on Win XP Regards, Tai

            S 1 Reply Last reply
            0
            • S Simon_Whale

              have a read of this Win32_DiskDrive class[^]

              Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

              T Offline
              T Offline
              taibc
              wrote on last edited by
              #6

              Hi Simon_Whale, Do you know what are differences between the property "SerialNumber" in Win32_PhysicalMedia and Win32_DiskDrive ? Thanks and regards, Tai

              1 Reply Last reply
              0
              • T taibc

                Thank you. Do you know what is difference between the property: SerialNumber of "Win32_PhysicalMedia" and SerialNumber of "Win32_DiskDrive" ? When I use Win32_DiskDrive, I can't get SerialNumber on Win XP Regards, Tai

                S Offline
                S Offline
                Simon_Whale
                wrote on last edited by
                #7

                As the Win32_DiskDrive document states, this property is not available on XP

                Quote:

                SerialNumber Data type: string Access type: Read-only Number allocated by the manufacturer to identify the physical media. Example: WD-WM3493798728 Windows Server 2003 and Windows XP: This property is not available.

                Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

                T 1 Reply Last reply
                0
                • S Simon_Whale

                  As the Win32_DiskDrive document states, this property is not available on XP

                  Quote:

                  SerialNumber Data type: string Access type: Read-only Number allocated by the manufacturer to identify the physical media. Example: WD-WM3493798728 Windows Server 2003 and Windows XP: This property is not available.

                  Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

                  T Offline
                  T Offline
                  taibc
                  wrote on last edited by
                  #8

                  Yes, do you know what is the property that I can get an unique value for computers that using win xp ? Thanks and regards, Tai

                  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