c# - Get Hard disk serial Number - Stack Overflow
stackoverflow.com › questions › 4084402Dec 18, 2014 · Get the Serial Number. searcher = new ManagementObjectSearcher ("SELECT * FROM Win32_PhysicalMedia"); int i = 0; foreach (ManagementObject wmi_HD in searcher.Get ()) { // get the hard drive from collection // using index HardDrive hd = (HardDrive)hdCollection [i]; // get the hardware serial no. if (wmi_HD ["SerialNumber"] == null) hd.SerialNo = "None"; else hd.SerialNo = wmi_HD ["SerialNumber"].ToString (); ++i; }
Get a hard drive serial number in C# - C# HelperC# Helper
csharphelper.com › blog › 2017Oct 14, 2017 · Get a hard drive serial number in C#. Posted on October 14, 2017 by RodStephens. The example Get a disk volume serial number in C# shows how you can find the serial number for a disk volume such as C:\. If you reformat or repartition the drive, however, the volume serial number may change. This example gets the hardware manufacturer’s serial number for the hard drive itself.
Get Serial Number of Hard Drive | C# Programming Exercise ...
ukacademe.com › Get_Serial_Number_of_Hard_DriveTo get serial number of hardisk create a method and call that method : public string GetHardDiskDSerialNumber(string drive) { if (string.IsNullOrEmpty( drive) || drive == null) { drive = "C"; } ManagementObject disk = new ManagementObject("Win32_LogicalDisk.DeviceID=\"" + drive + ":\""); disk.Get(); return disk ["VolumeSerialNumber"].ToString(); } private void BtnGetHardDiskNumber_Click(object sender, EventArgs e) { rtxtDiskInformation.