title: How to get the Hard Drive Serial number?
body: <p>Currently I am using the below code to get the serial number of Hard Drive:</p>
  
  <pre><code>private void GetAllDiskDrives()
  {
      var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
  
      foreach (ManagementObject wmi_HD in searcher.Get())
      {
          HardDrive hd = new HardDrive();
          hd.Model = wmi_HD["Model"].ToString();
          hd.InterfaceType = wmi_HD["InterfaceType"].ToString();
          hd.SerialNo = wmi_HD.GetPropertyValue("SerialNumber").ToString();//get the serailNumber of diskdrive
          HdCollection.Add(hd);
      }
  }
  
  public class HardDrive
  {
      public string Model { get; set; }
      public string InterfaceType { get; set; }
      public string SerialNo { get; set; }
  }
  </code></pre>
  
  <p>This code works fine.</p>
  
  <p>But the above code returns all the Drives. I just want to have only specific hard-drive (Not Partition) serial number on which my software is running.</p>
  
  <p>So, how can I get the serial number of hard-drive in which my software is running?</p>