The MSFT_StorageReliabilityCounter class is an associator of both MSFT_Disk and MSFT_PhysicalDisk. The documentation for its DeviceId property states that it is "An identifier that uniquely names the associated storage device. When associated with an MSFT_PhysicalDisk, it will be the same as its DeviceId member. When associated with an MSFT_Disk, it will be the same as its Number field."
Consequently, you can directly relate an MSFT_DIsk instance to its related MSFT_PhysicalDisk instance as follows:
Using MySearcher1 As New ManagementObjectSearcher("root\Microsoft\Windows\Storage", "SELECT * FROM MSFT_Disk WHERE IsSystem = TRUE")
For Each MyDisk As ManagementObject In MySearcher1.Get()
Dim disknumber As Integer = MyDisk("Number")
Console.WriteLine($"MSFT_Disk Number property is {disknumber}")
'
' Uncomment below if running as Administrator
'
'Dim src As ManagementObject = MyDisk.GetRelated("MSFT_StorageReliabilityCounter")(0)
'Dim srcId As String = src("DeviceId")
'Console.WriteLine($"MSFT_Disk->StorageReliabilityCounter device Id is {srcId}")
Using MySearcher2 As New ManagementObjectSearcher("root\Microsoft\Windows\Storage", $"SELECT * FROM MSFT_PhysicalDisk WHERE DeviceId = ""{disknumber}""")
For Each pd As ManagementObject In MySearcher2.Get()
Dim devId As String = pd("DeviceId")
Console.WriteLine($"MSFT_PhysicalDisk DeviceId property is {devId}")
'
' Uncomment below if running as Administrator
'
'Dim src2 As ManagementObject = pd.GetRelated("MSFT_StorageReliabilityCounter")(0)
'Dim src2Id As String = src2("DeviceId")
'Console.WriteLine($"MSFT_PhysicalDisk->StorageReliabilityCounter device Id is {src2Id}")
Next
End Using
Next
End Using
If running with Administrator privileges you can uncomment the indicated statements to see the value from the MSFT_StorageReliabilityCounter associator.