‎11-20-2014 02:15 PM
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,
Ceiling(tblPhysicalMemoryArray.MaxCapacity / 1024 / 1024 / 1024) As
MaxCapacityGB,
Cast(tblAssets.Memory / 1024 As Int) As MemoryGB,
Cast(CorrectMemory.Used As numeric) As SlotsUsed,
tblPhysicalMemoryArray.MemoryDevices As SlotsAvailable,
tblPhysicalMemoryArray.MemoryDevices - CorrectMemory.Used As SlotsFree
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tsysIPLocations On tsysIPLocations.LocationID =
tblAssets.LocationID
Inner Join tblState On tblState.State = tblAssetCustom.State
Inner Join tblPhysicalMemoryArray On tblAssets.AssetID =
tblPhysicalMemoryArray.AssetID
Inner Join (Select tblAssets.AssetID,
Sum(Ceiling(tblPhysicalMemory.Capacity / 1024 / 1024)) As Memory,
Count(tblPhysicalMemory.Win32_PhysicalMemoryid) As Used
From tblAssets
Left Outer Join (TsysMemorytypes
Right Outer Join tblPhysicalMemory On TsysMemorytypes.Memorytype =
tblPhysicalMemory.MemoryType) On tblAssets.AssetID =
tblPhysicalMemory.AssetID
Group By tblAssets.AssetID,
tblPhysicalMemory.MemoryType
Having (Case When tblPhysicalMemory.MemoryType <> 11 Then 'NoFlash'
Else 'Flash'
End) = 'NoFlash') CorrectMemory On CorrectMemory.AssetID = tblAssets.AssetID
Left Join tsysOS On tsysOS.OScode = tblAssets.OScode
Where Case When tblPhysicalMemoryArray.[Use] = 3 Then 'Physical Memory' Else ''
End = 'Physical Memory' And tblState.Statename = 'Active'
Order By tblAssets.Domain,
tblAssets.AssetName
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now