Windows Disk Usage query

Windows Disk Usage query

The article includes query to fetch the Windows Disk usage:


Query
SELCET DISTINCT

                upt_hostname,

                upt_time,

                device_id,

                size,

                free_space,

                size - free_space AS userspace,

                cast(size - free_space AS decimal(20, 2)) / cast(size AS decimal(20, 0))*100 AS PERCENT 

FROM

            logical_drives 

WHERE

            size > 0