United Kingdom Endpoint Management User Group

 View Only

How to Report on Available Disk Space on All Computers as Well as Only on Site Servers 

Feb 14, 2014 05:46 PM

The first query targets all computer resources and allows you to specify the byte size range as well as the percentage of available disk space.

The second query only targets site servers.  It provide similar options as the first, but also allow you to specify a particular site service.

***************************************************

--/ Disk space on all computer resources
SELECT
vc.[Guid] AS ResourceGuid,
vc.[Name] AS [Resource],
ld.[Device ID] AS Drive,
ld.[Description] AS [Description],
ld.[Size (Bytes)] AS [Disk Size Bytes],
(ld.[Size (Bytes)])/1024/1024/1024 AS [Disk Size GB],
ld.[Free Space (Bytes)] AS [Free Space Bytes],
(ld.[Free Space (Bytes)])/1024/1024 AS [Free Space MB],
CONVERT(DECIMAL(5,2),100.0 * ld.[Free Space (Bytes)] / ld.[Size (Bytes)]) AS [Free Space(%)], --this is the percentage field
pu.[User] AS [Primary User]
FROM vComputer vc
INNER JOIN vHWLogicalDisk ld ON vc.[Guid] = ld._ResourceGuid
LEFT JOIN Inv_AeX_AC_Primary_User pu ON vc.[Guid] = pu._ResourceGuid
WHERE pu.[Month] = DATENAME(mm, GETDATE())
AND LOWER(ld.[Description]) LIKE '%local%'
--AND t1.[Size (Bytes)] > '2000'
--AND CONVERT(DECIMAL(5,2),100.0 * ld.[Free Space (Bytes)] / ld.[Size (Bytes)]) < '10' ---this is the percentage parameter
ORDER BY vc.[Name]


--/ Disk space on site servers only
SELECT DISTINCT
ss.ComputerGuid AS SiteServerGuid,
vc.[Name] AS SiteServer,
ss.[IP Address],
ld.[Device ID] AS Drive,
ld.[Description] AS [Description],
ld.[Size (Bytes)] AS [Disk Size Bytes],
(ld.[Size (Bytes)])/1024/1024/1024 AS [Disk Size GB],
ld.[Free Space (Bytes)] AS [Free Space Bytes],
(ld.[Free Space (Bytes)])/1024/1024 AS [Free Space MB],
CONVERT(DECIMAL(5,2),100.0 * ld.[Free Space (Bytes)] / ld.[Size (Bytes)]) AS [Free Space(%)], --this is the percentage field
pu.[User] AS [Primary User]
FROM vComputer vc
JOIN vSiteServices ss ON ss.ComputerGuid = vc.[Guid]
JOIN vItem vi ON vi.[Guid] = ss.ResourceTypeGuid
INNER JOIN vHWLogicalDisk ld ON vc.[Guid] = ld._ResourceGuid
LEFT JOIN Inv_AeX_AC_Primary_User pu ON vc.[Guid] = pu._ResourceGuid
WHERE pu.[Month] = DATENAME(mm, GETDATE())
AND LOWER(ld.[Description]) LIKE '%local%'
--AND t1.[Size (Bytes)] > '2000'
--AND CONVERT(DECIMAL(5,2),100.0 * ld.[Free Space (Bytes)] / ld.[Size (Bytes)]) < '10' ---this is the percentage parameter
--AND vi.[Name] = 'MonitorService'  
--AND vi.[Name] = 'PackageService'
--AND vi.[Name] = 'TaskService'
ORDER BY vc.[Name]

Statistics
0 Favorited
1 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Oct 31, 2017 09:12 PM

Thank you very much! 

Aug 21, 2017 09:07 AM

this has worked very well on my 7.6 environment...

how can I add a " AND " to the where free space % less than X (will be an editable field) ?

 

Dec 09, 2016 08:22 AM

This was very helpfull for me at least... Thank you very much! :D

Feb 15, 2014 02:50 AM

After checking my 7.1.x system I have found that that view does not exist in its database, so I have created the following article (currently waiting to be published) that explains how to add that 7.5 view to a 7.1.x database:-  https://www-secure.symantec.com/connect/articles/how-add-useful-75-vsiteservices-view-71x-system

Related Entries and Links

No Related Resource entered.