I’m trying to determine what type of Hard drive types my computers have, so i wrote the following:
q: if (select “MediaType FROM MSFT_PhysicalDisk” of wmis “ROOT\Microsoft\Windows\Storage” as string) contains “4” as string then “SSD” else if (select “MediaType FROM MSFT_PhysicalDisk” of wmis “ROOT\Microsoft\Windows\Storage” as string) contains “3” as string then “HDD” else if (select “MediaType FROM MSFT_PhysicalDisk” of wmis “ROOT\Microsoft\Windows\Storage” as string) contains “0” as string then “Unspecified” else nothing
A: SSD
T: 164.627 ms
I: plural string
this works great, but only for computers with only one hard drive.
if I use “selects” instead of “Select” i get “A singular expression is required.” error.
how can I write it in a way that will display multiple results in a friendly name?
usually I don’t like using WMI as its a heavy query, and it can be done with PowerShell (Get-PhysicalDisk | Select MediaType) but that would require a 2-step approach (write the output to a file or registry, and a property to read it) so I was forced to use WMI.