Query Exchange

 View Only
  • 1.  Disk utilization on Windows

    Broadcom Employee
    Posted Sep 30, 2021 08:03 PM

    This query converts the size and free space to GB, then calculate the percent full for the disk.

    +-----------+------------------+-------------+-----------------+-----------+--------+
    | device_id | description      | file_system | free_space (GB) | size (GB) | %_free |

    +-----------+------------------+-------------+-----------------+-----------+--------+
    | C:        | Local Fixed Disk | NTFS        | 0.94            | 7.43      | 12.65  |

    +-----------+------------------+-------------+-----------------+-----------+--------+

     

    select device_id,description,file_system,
      printf("%.2f", free_space/8589934592.0) as 'free_space (GB)',
      printf("%.2f", size/8589934592.0) as 'size (GB)',
      printf("%.2f", (printf("%.2f", free_space/8589934592.0)/printf("%.2f", size/8589934592.0))*100) as '%_free'
    from logical_drives
    where size != '-1';

     

     

     


    #CarbonBlack
    #Windows
    #HelpDeskOperations
    #ITHygiene


  • 2.  RE: Disk utilization on Windows

    Broadcom Employee
    Posted Sep 30, 2021 08:04 PM


  • 3.  RE: Disk utilization on Windows

    Broadcom Employee
    Posted Nov 18, 2021 11:43 PM

     I believe this needs to be "%_free"



  • 4.  RE: Disk utilization on Windows

    Broadcom Employee
    Posted Nov 18, 2021 11:58 PM

     math is hard. Thanks!