→ 🚀What's New? Explore Lansweeper's Fall 2024 Updates! Fall Launch Blog !
‎07-03-2013 09:04 PM
Select Top 1000000 tblDiskdrives.Caption,
Cast(Cast(tblDiskdrives.Freespace As bigint) / 1024 / 1024 As numeric) /
1024 As [GB Free],
Floor(Cast(Cast(tblDiskdrives.Freespace As bigint) / 1024 / 1024 As numeric) /
Cast(Cast(tblDiskdrives.Size As bigint) / 1024 / 1024 As numeric) *
100) As Freepct,
Cast(Cast(tblDiskdrives.Size As bigint) / 1024 / 1024 As numeric) As
[Total size],
tblDiskdrives.Lastchanged As [Last changed],
tblAssets.AssetID,
tblAssets.Description,
tblAssets.AssetName
From tblDiskdrives
Inner Join tblAssets On tblAssets.AssetID = tblDiskdrives.AssetID
Inner Join tblOperatingsystem
On tblAssets.AssetID = tblOperatingsystem.AssetID
Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Where Floor(Cast(Cast(tblDiskdrives.Freespace As bigint) / 1024 / 1024
As numeric) / Cast(Cast(tblDiskdrives.Size As bigint) / 1024 /
1024 As numeric) * 100) <= 20 And Cast(Cast(tblDiskdrives.Size As bigint) /
1024 / 1024 As numeric) <> 0 And tblComputersystem.Domainrole > 1 And
tblDiskdrives.DriveType = '3'
Order By Floor(Cast(Cast(tblDiskdrives.Freespace As bigint) / 1024 /
1024 As numeric) / Cast(Cast(tblDiskdrives.Size As bigint) / 1024 /
1024 As numeric) * 100),
Cast(Cast(tblDiskdrives.Freespace As bigint) / 1024 / 1024 As numeric) / 1024,
tblDiskdrives.Caption
Solved! Go to Solution.
‎07-03-2013 11:50 PM
Select Top 1000000
tblDiskdrives.Caption,
tblDiskdrives.Freespace,
Cast(tblDiskdrives.Freespace / tblDiskdrives.Size * 100 As Numeric(36,2)) As [% Free],
-- base 2 gigs (memory is measured in base 2)
Cast(tblDiskdrives.Freespace / Power(2, 30) As Numeric(36,2)) As [GiB Free],
Cast(tblDiskdrives.Size / Power(2, 30) As Numeric(36,2)) As [GiB Capacity],
-- base 10 gigs (hard drives and such are marketed in base 10)
Cast(tblDiskdrives.Freespace / Power(10, 9) As Numeric(36,2)) As [GB Free],
Cast(tblDiskdrives.Size / Power(10, 9) As Numeric(36,2)) As [GB Capacity],
tblDiskdrives.Lastchanged As [Last changed],
tblAssets.AssetID,
tblAssets.Description,
tblAssets.AssetName
From
tblDiskdrives
Inner Join tblAssets On tblAssets.AssetID = tblDiskdrives.AssetID
Inner Join tblOperatingsystem On tblAssets.AssetID = tblOperatingsystem.AssetID
Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Where
tblComputersystem.Domainrole > 1
And tblDiskdrives.DriveType = '3'
-- drive capacity is not zero MebiBytes
And Floor(tblDiskdrives.Size / Power(2, 20)) <> 0
-- available space <= 20%
And tblDiskdrives.Freespace / tblDiskdrives.Size * 100 <= 20
-- CHOOSE ONE:
-- EITHER (base 2 gigs free < 25)
AND Floor(tblDiskdrives.Freespace / Power(2, 30) ) < 25
-- OR (base 10 gigs free < 25)
AND Floor(tblDiskdrives.Freespace / Power(10, 9) ) < 25
Order By
[% Free],
tblDiskdrives.Freespace,
tblDiskdrives.Caption
‎07-05-2013 07:41 PM
100 - Cast(tblDiskdrives.Freespace / tblDiskdrives.Size * 100 As
Numeric(36,2)) As [% Used],
Cast((tblDiskdrives.Size - tblDiskdrives.Freespace) / tblDiskdrives.Size *
100 As Numeric(36,2)) As [% Used],
‎07-05-2013 07:16 PM
‎07-03-2013 11:50 PM
Select Top 1000000
tblDiskdrives.Caption,
tblDiskdrives.Freespace,
Cast(tblDiskdrives.Freespace / tblDiskdrives.Size * 100 As Numeric(36,2)) As [% Free],
-- base 2 gigs (memory is measured in base 2)
Cast(tblDiskdrives.Freespace / Power(2, 30) As Numeric(36,2)) As [GiB Free],
Cast(tblDiskdrives.Size / Power(2, 30) As Numeric(36,2)) As [GiB Capacity],
-- base 10 gigs (hard drives and such are marketed in base 10)
Cast(tblDiskdrives.Freespace / Power(10, 9) As Numeric(36,2)) As [GB Free],
Cast(tblDiskdrives.Size / Power(10, 9) As Numeric(36,2)) As [GB Capacity],
tblDiskdrives.Lastchanged As [Last changed],
tblAssets.AssetID,
tblAssets.Description,
tblAssets.AssetName
From
tblDiskdrives
Inner Join tblAssets On tblAssets.AssetID = tblDiskdrives.AssetID
Inner Join tblOperatingsystem On tblAssets.AssetID = tblOperatingsystem.AssetID
Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Where
tblComputersystem.Domainrole > 1
And tblDiskdrives.DriveType = '3'
-- drive capacity is not zero MebiBytes
And Floor(tblDiskdrives.Size / Power(2, 20)) <> 0
-- available space <= 20%
And tblDiskdrives.Freespace / tblDiskdrives.Size * 100 <= 20
-- CHOOSE ONE:
-- EITHER (base 2 gigs free < 25)
AND Floor(tblDiskdrives.Freespace / Power(2, 30) ) < 25
-- OR (base 10 gigs free < 25)
AND Floor(tblDiskdrives.Freespace / Power(10, 9) ) < 25
Order By
[% Free],
tblDiskdrives.Freespace,
tblDiskdrives.Caption
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now