SELECT workstation.WORKSTATIONNAME "Workstation",
workstation.SERVICETAG "Service Tag",
workstation.MODEL "Model",
aaov.NAME "Site",
hdi.CAPACITY/1024/1024/1024 "Hard drive Capacity",
dri.DRIVENAME "Drive Name",
Dri.CAPACITY/1024/1024/1024 "Drive Capacity",
(
dri.FREESPACE/1024)/1024/1024 "Drive Free Space",
case when Dri.CAPACITY=0 then null else ((Dri.CAPACITY-Dri.FREESPACE) * 100 /Dri.CAPACITY) end "Usage" FROM SystemInfo workstation
LEFT JOIN Resources resource ON workstation.WORKSTATIONID=resource.RESOURCEID
LEFT JOIN ResourceLocation resLocation ON resource.RESOURCEID=resLocation.RESOURCEID
LEFT JOIN SiteDefinition siteDef ON resLocation.SITEID=siteDef.SITEID
LEFT JOIN SDOrganization aaov ON siteDef.SITEID=aaov.ORG_ID
LEFT JOIN HardDiskInfo hdi ON workstation.WORKSTATIONID= hdi.WORKSTATIONID
LEFT JOIN DriveInfo dri ON workstation.WORKSTATIONID=dri.WORKSTATIONID