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.Caption = wmi_HD["Caption"].ToString(); hd.SerialNo =wmi_HD.GetPropertyValue("SerialNumber").ToString();//get the serailNumber of diskdrive hdCollection.Add(hd); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)