title: How to get all S.M.A.R.T. data of StorageSpaces physical disks on .Net?
body: <p>There are 2 most popular ways: PowerShell (<code>PowerShell.Create()...</code>) and WMI (<code>ManagementObjectSearcher</code>).</p>
  
  <p>1) PowerShell <code>Get-PhysicalDisk</code> can retrieve disks properly, but it doesn't have VendorSpecific property (SMART). There is <code>Get-StorageReliabilityCounter</code> that populates some common SAMRT properties, but not all of them. Specifically it does not show 'Reallocated Sectors Count' and 'Pending Sectors'</p>
  
  <p><a href="https://i.stack.imgur.com/sZaAx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sZaAx.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/Fyb52.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fyb52.png" alt="enter image description here"></a></p>
  
  <p>2) WMI <code>SELECT * FROM Win32_DiskDrive</code> can be queried but this one shows virtual disks. Actual physical disks is not there. For software RAID (Add Mirror in Disk Management) or for Storage Spaces actual physical disks are already filtered out. <code>SELECT * FROM MSStorageDriver_FailurePredictData</code> shows SMRART (VendorSpecific) information that I'm looking for, but there no physical drives as well and no way to associate the 'InstanceName' with actual list of a disk.</p>
  
  <p><a href="https://i.stack.imgur.com/wuLQh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wuLQh.png" alt="enter image description here"></a></p>
  
  <p>At the same time, 3rd party software can clearly show both physical and virtual disks (storage spaces itself) and can show SMART for them:</p>
  
  <p><a href="https://i.stack.imgur.com/vuek5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vuek5.png" alt="enter image description here"></a></p>
  
  <p>At the end of the day I want to have it in .Net application and I googled some code how to extract this info (Reallocated Sectors Count) from VendorSpecific field of WMI object, but I just don't see WMI object of actual physical disks.</p>