Wednesday, February 8, 2012

SCCM SQL Query: Disk Usage Reports

I can't take credit for all the SQL in this report, but I did tweak it enough to make it my own. Just change "FCM.CollectionID = 'SMS000DS'" to reflect the Collection ID of whatever Collection you want to run the report against. In my case I'm using the built-in collection for all servers:

 List all servers with Disk Usage Summary:

SELECT DISTINCT FCM.Name AS 'Computer Name', LDSK.DeviceID0 'Drive Letter', LDSK.Description0, LDSK.VolumeName0, LDSK.FreeSpace0 AS 'Free Space (MB)', LDSK.FreeSpace0/1024 AS 'Free Space (GB)', LDSK.FreeSpace0*100/LDSK.Size0 AS 'Free Space (%)', LDSK.Size0/1024 AS 'Total Space (GB)' FROM v_FullCollectionMembership FCM JOIN v_GS_LOGICAL_DISK LDSK on FCM.ResourceID = LDSK.ResourceID JOIN v_R_System SYS ON FCM.ResourceID = SYS.ResourceID WHERE LDSK.DriveType0 = 3 AND LDSK.Size0 > 0 AND FCM.CollectionID = 'SMS000DS' ORDER BY FCM.Name, LDSK.DeviceID0

No comments:

Post a Comment