Analyse for Disks

Hello,

I would like to write a analyse for all connected Disks on Windows Clients. The output should include the following information/format:
Drive, total capacity, free, free in %, serialnumber.

I am tested the following statements:

  1. Statement

(string value of property “DriveLetter” of it, (string value of property “Capacity” of it as integer / 1024 / 1024 / 1024) as string & " GB", (string value of property “FreeSpace” of it as integer / 1024 / 1024 / 1024) as string & " GB",

((string value of property “FreeSpace” of it as floating point / string value of property “Capacity” of it as floating point * 100) as integer as string & " percent free" of it), (string value of property “SerialNumber” of it)) of

(select objects (“Label,DriveLetter, Capacity,FreeSpace, SerialNumber from Win32_Volume where DriveLetter= ‘C:’”) of WMI)

  1. Statement
    if (exists wmi) then (concatenation ", " of (((substrings after “=” whose(it as trimmed string != “”) of (property “SerialNumber” of it as string)) of select objects “* from win32_PhysicalMedia where SerialNumber != ‘’” of wmi) as

trimmed string)) else “n/a”

now my questions:

  • Why is the serialnumber within the object Win32_Volume differnt to the object win32_PhysicalMedia?
  • If I want to have the serialnumber from the win32_PhysicalMedia, how can I combine this with the first statement?
  • If I remove the where clause "where DriveLetter= ‘C:’ from the first statement, I got an error “Singular expression refers to nonexistent object”

Thanks for helping

Josef