Notification

Icon
Error

Windows: Disk space with color code (Built-in)

Posted: Tuesday, August 8, 2017 3:39:53 PM(UTC)
Nick.VDB

Nick.VDB

Member Lansweeper Developer Administration Original PosterPosts: 251
0
Like
Added in v.6.0.100

The report below lists Windows computers and their hard drive disk space in GB. Hard drives that have less than 10% space are given back in red. Hard drives with less than 30% disk space are given back in orange.

The report will only list assets that meet all of the following criteria:
  • The asset state is set to "active".
  • The asset has been successfully scanned at least once.
  • The asset is a Windows computer.

Code:

Select Top 1000000 tblAssets.AssetID,
  tblAssets.AssetName,
  tblAssets.Domain,
  tblAssets.Username,
  tblAssets.Userdomain,
  Coalesce(tsysOS.Image, tsysAssetTypes.AssetTypeIcon10) As icon,
  tblAssets.IPAddress,
  tsysIPLocations.IPLocation,
  tblAssetCustom.Manufacturer,
  tblAssetCustom.Model,
  tsysOS.OSname As OS,
  tblAssets.SP,
  tblAssets.Lastseen,
  tblAssets.Lasttried,
  tblDiskdrives.Caption As Drive,
  Cast(tblDiskdrives.Freespace / 1024 / 1024 / 1024 As numeric) As FreeGB,
  Cast(tblDiskdrives.Size / 1024 / 1024 / 1024 As numeric) As TotalSizeGB,
  Ceiling(tblDiskdrives.Freespace / (Case tblDiskdrives.Size When 0 Then 1
    Else tblDiskdrives.Size End) * 100) As [%SpaceLeft],
  Case When Ceiling(tblDiskdrives.Freespace / (Case tblDiskdrives.Size
      When 0 Then 1 Else tblDiskdrives.Size End) * 100) < 10 Then '#f7caca'
    When Ceiling(tblDiskdrives.Freespace / (Case tblDiskdrives.Size
      When 0 Then 1 Else tblDiskdrives.Size End) * 100) < 30 Then '#f7f0ca'
  End As backgroundcolor,
  tblDiskdrives.Lastchanged As LastChanged
From tblAssets
  Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID
  Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
  Inner Join tblState On tblState.State = tblAssetCustom.State
  Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
  Inner Join tsysIPLocations On tsysIPLocations.LocationID =
    tblAssets.LocationID
  Left Join tsysOS On tblAssets.OScode = tsysOS.OScode
Where Cast(tblDiskdrives.Size / 1024 / 1024 / 1024 As numeric) <> 0 And
  tblState.Statename = 'Active' And Case tblDiskdrives.DriveType
    When 3 Then 'Local Disk' End = 'Local Disk'
Order By [%SpaceLeft],
  tblAssets.Domain,
  tblAssets.AssetName,
  Drive

Active Discussions

Action Remote Uninstaller
by  miek_g   Go to last post Go to first unread
Last post: 10/28/2020 3:52:20 PM(UTC)
Action Setting Computer AD Description Attribute
by  DJSMC  
Go to last post Go to first unread
Last post: 10/27/2020 12:39:54 PM(UTC)
Action Open Teams/SfB Chat with user
by  marceman   Go to last post Go to first unread
Last post: 9/10/2020 4:10:18 PM(UTC)
Lansweeper Report showing app even after it has gone
by  TimHolmes1973  
Go to last post Go to first unread
Last post: 9/9/2020 11:50:17 PM(UTC)
Action Remote Device Manager
by  steveb   Go to last post Go to first unread
Last post: 9/4/2020 9:52:01 PM(UTC)
Action View Windows Defender detections remotely
by  steveb  
Go to last post Go to first unread
Last post: 9/4/2020 9:37:48 PM(UTC)
Lansweeper Filter Assets' groups by WinSystemLocale
by  Alex Beaumier   Go to last post Go to first unread
Last post: 8/20/2020 4:17:17 PM(UTC)
Action Chrome History
by  csys  
Go to last post Go to first unread
Last post: 8/14/2020 2:14:21 PM(UTC)