Wednesday, February 4, 2015

Show Disk Usage

To begin hardware inventory of Free Space, go to the following area within the admin console:
  • Administration ->  Client Settings -> Right-click “Default Client Settings” and select Properties -> Hardware Inventory -> click on Set Classes
  • Expand “Logical Disk (SMS_LogicalDisk)”
  • Place a check on “Free Space (MB)”
  • Click OK.
This will instruct all clients to update policy for Hardware Inventory and begin reporting Free Space in MB.
diskusage1
Depending on the hardware inventory scan cycle, it may take a few days to obtain metrics from all machines. When machines report both size of logical disks along with free space, both numbers will be in megabytes (MB). Subtracting logical disk size minus free space will yield usage. This query will perform the subtraction along with the conversion of megabytes (MB) to gigabytes (GB). In addition, it will also calculate the free space percentage for each logical disk.
select SystemName0 as 'Machine Name', DeviceID0 as 'Logical Drive', FileSystem0 as 'File System', convert(decimal(20,0),round(1.0*Size0/1024,0)) as 'Capacity GB',
convert(decimal(20,0),round(1.0*(Size0-FreeSpace0)/1024,0)) as 'UsedSpace GB', convert(decimal(20,0),round(1.0*FreeSpace0/1024,0)) as 'FreeSpace GB',
convert(decimal(20,1),round((cast(FreeSpace0 as decimal)/ cast(Size0 as decimal) * 100),1)) as 'Percent Free',
VolumeName0 as 'Volume Name'
from v_GS_LOGICAL_DISK
where (Size0 is not null) and (FreeSpace0 is not null)
Order by Systemname0, DeviceID0

No comments:

Post a Comment