cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
imcuadmin
Engaged Sweeper
I am trying to get a percentage of free space but I am getting all zeros???
Also I would like to see 0 percent but I am getting divide by 0 errors when the free space is 0.


Select
Top 1000000
tblComputers.Computer,
Web40OSName.OSname,
tblComputers.LastknownIP,
tblDiskdrives.Caption,
Cast(tblDiskdrives.Freespace As bigint) / 1024 /1024 As [Free Space in MB],
Cast(tblDiskdrives.Size As bigint) / 1024 /1024 As [Total Space in MB],
Cast(tblDiskdrives.Size / tblDiskdrives.Freespace As bigint) / 1024 / 1024 * 100 As [Percentage Free],
tblDiskdrives.Lastchanged As [Last changed],
Web40OSName.Compimage As icon
From tblComputers
Inner Join tblDiskdrives On tblComputers.Computername = tblDiskdrives.Computername
Inner Join tblOperatingsystem On tblComputers.Computername = tblOperatingsystem.Computername
Inner Join web40ActiveComputers On tblComputers.Computername = web40ActiveComputers.Computername
Inner Join Web40OSName On Web40OSName.Computername = tblComputers.Computername
Inner Join tblComputersystem On tblComputers.Computername = tblComputersystem.Computername
Where
tblComputersystem.Domainrole > 1
And tblDiskdrives.DriveType = '3'
and tblDiskdrives.Freespace > 0
Order By
tblComputers.LastknownIP,
dbo.tblDiskdrives.Caption
3 REPLIES 3
CMCSDIT
Engaged Sweeper
You have a report for Device: Partition less than 10% free space what about computers Partition less than 10% free space. Can you give me a report for that?
Hemoco
Lansweeper Alumni
CMCSDIT wrote:
You have a report for Device: Partition less than 10% free space what about computers Partition less than 10% free space. Can you give me a report for that?


Please use the following report:

Select Top 100 Percent tblComputers.Computername As Computer,
tblComputers.ComputerUnique, tblDiskdrives.Caption As Drive,
Cast(Cast(tblDiskdrives.Size As BigInt) / 1024 / 1024 / 1024 As Numeric) As
[Total size (GB)], Cast(Cast(tblDiskdrives.Freespace As BigInt) / 1024 /
1024 / 1024 As Numeric) As [Free in GB], Cast((Cast(tblDiskdrives.Size As
BigInt) - Cast(tblDiskdrives.Freespace As BigInt)) / 1024 / 1024 /
1024 As Numeric) As [Used Space (GB)], Cast(Cast(Cast(tblDiskdrives.Freespace
As BigInt) / 1024 / 1024 / 1024 As Numeric) / Cast(Cast(tblDiskdrives.Size As
BigInt) / 1024 / 1024 / 1024 As Numeric) * 100 As bigint) As [Free PCT],
tblFloppy.Model As [HDD Model], tblDiskdrives.Lastchanged As [Last changed]
From tblComputers Left Join
tblDiskdrives On tblComputers.Computername = tblDiskdrives.Computername
Left Join
tblFloppy On tblComputers.Computername = tblFloppy.Computername
Where Cast(Cast(Cast(tblDiskdrives.Freespace As BigInt) / 1024 / 1024 /
1024 As Numeric) / Cast(Cast(tblDiskdrives.Size As BigInt) / 1024 / 1024 /
1024 As Numeric) * 100 As bigint) < 10 And tblDiskdrives.DriveType = '3'
Order By tblComputers.Computername, tblDiskdrives.Caption, tblFloppy.Model
Hemoco
Lansweeper Alumni
Please try the following report instead:

Select Top 100 Percent tblComputers.Computername As Computer,
tblComputers.ComputerUnique, tblDiskdrives.Caption As Drive,
Cast(Cast(tblDiskdrives.Size As BigInt) / 1024 / 1024 / 1024 As Numeric) As
[Total size (GB)], Cast(Cast(tblDiskdrives.Freespace As BigInt) / 1024 /
1024 / 1024 As Numeric) As [Free in GB], Cast((Cast(tblDiskdrives.Size As
BigInt) - Cast(tblDiskdrives.Freespace As BigInt)) / 1024 / 1024 /
1024 As Numeric) As [Used Space (GB)], Cast(Cast(Cast(tblDiskdrives.Freespace
As BigInt) / 1024 / 1024 / 1024 As Numeric) / Cast(Cast(tblDiskdrives.Size As
BigInt) / 1024 / 1024 / 1024 As Numeric) * 100 As bigint) As [Free PCT],
tblFloppy.Model As [HDD Model], tblDiskdrives.Lastchanged As [Last changed]
From tblComputers Left Join
tblDiskdrives On tblComputers.Computername = tblDiskdrives.Computername
Left Join
tblFloppy On tblComputers.Computername = tblFloppy.Computername
Where tblDiskdrives.DriveType = '3'
Order By tblComputers.Computername, tblDiskdrives.Caption, tblFloppy.Model