‎08-25-2021 07:58 AM
Select Top 1000000 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.Username,
SubQuery2.Value As [Battery Design Capacity],
SubQuery1.Value As [Battery Capacity],
Case
When SubQuery1.Value < '30000' Then '#ffadad'
When SubQuery1.Value < '35000' Then '#fff1ad'
When SubQuery1.Value > '35000' Then '#d4f4be'
End As backgroundcolor,
tblWarrantyDetails.WarrantyEndDate,
SubQuery1.Lastchanged,
TsysLastscan.Lasttime As LastRegistryScan,
tblAssets.Lastseen,
Case
When TsysLastscan.Lasttime < GetDate() - 1 Then
'Last registry scan more than 24 hours ago! Scanned registry information may not be up-to-date. Try rescanning this machine.'
End As Comment
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join TsysLastscan On tblAssets.AssetID = TsysLastscan.AssetID
Inner Join TsysWaittime On TsysWaittime.CFGCode = TsysLastscan.CFGcode
Left Join (Select Top 1000000 tblRegistry.AssetID,
tblRegistry.Regkey,
tblRegistry.Valuename,
tblRegistry.Value,
tblRegistry.Lastchanged
From tblRegistry
Where tblRegistry.Regkey Like '%SOFTWARE\lansweeper' And
tblRegistry.Valuename = 'BatteryCapacity') SubQuery1 On
SubQuery1.AssetID = tblAssets.AssetID
Left Join (Select Top 1000000 tblRegistry.AssetID,
tblRegistry.Regkey,
tblRegistry.Valuename,
tblRegistry.Value,
tblRegistry.Lastchanged
From tblRegistry
Where tblRegistry.Regkey Like '%SOFTWARE\lansweeper' And
tblRegistry.Valuename = 'BatteryDesignedCapacity') SubQuery2 On
SubQuery2.AssetID = tblAssets.AssetID
Inner Join lansweeperdb.dbo.tblWarranty On tblAssets.AssetID =
tblWarranty.AssetId
Inner Join lansweeperdb.dbo.tblWarrantyDetails On tblWarranty.WarrantyId =
tblWarrantyDetails.WarrantyId
Where Case
When SubQuery1.Valuename Is Not Null And SubQuery1.Valuename <> ''
Then 'Yes'
Else 'No'
End = 'Yes' And tblAssetCustom.State = 1 And TsysWaittime.CFGname = 'registry'
Order By [Battery Capacity],
tblAssets.Domain,
tblAssets.AssetName
‎08-25-2021 04:37 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now