I want to calculate total and free disk space available on machine using WMI. and query for that is => select Size,FreeSpace from Win32_LogicalDisk.
this query returns multiple rows as machine has more that one drive. If I sum this columns then I will get expected result. I can easily achieve this in sql by query
SELECT sum(Size), sum(FreeSpace) FROM Win32_LogicalDisk
but it gives error for wql.
How can I achieve same in wql?
The WQL
language has not support for the SUM function, because is only a subset of the SQL language, in order to get the total you must iterate over the instances and calculate the value yourself.