public static IEnumerable <IDiskDrive> Query(IComputerSystem host) { Invariant.ArgumentNotNull((object)host, nameof(host)); ManagementObjectCollection moc = new ManagementScope(string.Format("\\\\{0}\\root\\cimv2", (object)((IWMICommon)host).Scope.Path.Server)).Query("Select * from Win32_DiskDrive"); try { foreach (ManagementObject instance in moc) { yield return((IDiskDrive) new DiskDrive(instance)); } } finally { if (moc != null) { moc.Dispose(); } } moc = (ManagementObjectCollection)null; }